Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2013

    Unanswered: Opening Form with Where Condition Temps Vars

    Afternoon All

    I have the following code that opens a form in data sheet view using tempvars which are created when the user clicks on the text

    Private Sub Summarysearch_Click()
    DoCmd.Openform "IncidentSummarys", , , "[Campus]='" & TempVars!SrchRptcampusFilter & "' and [Type of Incident]='" & TempVars!SrchRptIncTypeFilter & "' and [Location]='" & TempVars!SrchRptLocFilter & "' and [Attended By]='" & TempVars!SrchRptOfficerFilter & " '"
    End Sub

    This works if all the Tempvars have been created but not if they are not created

    So to my understanding you can use the Nz function if says a temovar has not been created but I cannot seem to get it to work

    Any help would be helpful


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    the nz function allows you to replace a null value with something else NOT if a variable can't be found
    Nz Function - Access -
    what I'd suggest you do is rewrite your code and place sane values

    what you could do is examine each tempvar you plan on using, throw error trapping around each attempt. if the value is not found set a new value as rtequired

    just open the form with using any tempvars at all
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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