Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need to replace a part of my function (97)

    here

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: need to replace a part of my function (97)

    First off, let's make your existing code a little clearer:

    <pre>Dim varNewNum As Variant
    Dim strCriteria As String

    strCriteria = "regionaldirectorcode=" & glblDirCode _
    & " And promotiontype='OA'"

    varNewNum = DMax("eventnumber","newquery", strCriteria)

    Me.EventNumber = Nz(varNewNum,0) + 1</pre>


    Now, if you want to limit the search to the filtered results, and assuming the query you're searching is also the recordsource for your form, you can use the filter string of the form to add additional criteria right after the "strCriteria = ..." line like this:

    <pre>If Me.Filter <> vbNullString then
    strCriteria = strCriteria & " And " & Me.Filter
    End If</pre>

    Charlotte

Posting Permissions

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