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

    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

    Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    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 - Office.com
    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

    OR
    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
  •