Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clear a 'Form' (Outlook 98)

    I have a form that is filled out each day. How would I program a button that will clear out anything I enter into certain fields. Example: Date, Location, Amount used (total of 15 fields). It would be eazy to press a button if I entered the wrong data and erase it all.

  2. #2
    5 Star Lounger
    Join Date
    May 2001
    Location
    Washington, USA
    Posts
    750
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear a 'Form' (Outlook 98)

    You can reference a field value like this: Item.UserProperties.find("strTitle").value = " "

    You can reference a custom page like this: set mypage = item.getinspector.modifiedformpages("Create Search")

    In the above examples "strTitle" is a field and "Create Search" is the name/lable of a custom page.

    G'Luck!

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear a 'Form' (Outlook 98)

    how can I do that? Can I setup a but so that I can just press it and it will clear out?

  4. #4
    5 Star Lounger
    Join Date
    May 2001
    Location
    Washington, USA
    Posts
    750
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear a 'Form' (Outlook 98)

    Umm. I'm not sure what you're asking exactly. You put a button on a form and name it, say "btnClearFlds". To get at the form code area select Form menu | ViewCode.

    You'll need a code block for the actions you want to take. This shows how to clear a custom field called strTitle that is on the main tab:

    Sub btnClearFlds_Click
    If item.userproperties.find("strTitle").value <> "" then
    Item.UserProperties.find("strTitle").value = " "
    End If
    End Sub

    If your fields are on a custom tab you have to first set the focus to that tab with a line like the one below - before your start referencing the fields. This example uses a tab called My Fields.

    set mypage = item.getinspector.modifiedformpages("My Fields")

  5. #5
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Houston, Texas, USA
    Posts
    432
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear a 'Form' (Outlook 98)

    It works fine when I am doing fields with text, but when I get to a field that is Numberic, checkbox or a date I get the following errors = Type Mismatch: Unable to coerce parameter value. Outlook cannot translate your string.

    If item.userproperties.find("av").value <> " " then
    Item.UserProperties.find("av").value = " "
    End If

    Any ideas?

  6. #6
    5 Star Lounger
    Join Date
    May 2001
    Location
    Washington, USA
    Posts
    750
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear a 'Form' (Outlook 98)

    None of my resources indicate you can sent non-text objects to a null/empty value after they've been set to something else. Unless someone knows otherwise, I think you have to reset them to dummy values, as in:


    ...datecontrol.value = #01/01/01#

    or

    ireset = 0
    ... somenumber.value = ireset

    or

    ...somecheckbox = False

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •