Results 1 to 5 of 5
  1. #1
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    multiple link criteria (2003)

    I have a command button on a form to open another form based on:

    <pre> Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmCommitteeDetail"

    stLinkCriteria = "[numActivityID]=" & Me![autoActivityID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria</pre>


    Can I add a second criteria? "[txtCommitteeChair] =" & Me! [txtStaff1]
    I tried using AND following the 1st criteria and got a type mismatch error.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: multiple link criteria (2003)

    Try:
    stLinkCriteria = "[numActivityID]=" & Me![autoActivityID] & " And [txtCommitteeChair] =" & Me![txtStaff1] if txtCommitteeChair is numeric
    or
    stLinkCriteria = "[numActivityID]=" & Me![autoActivityID] & " And [txtCommitteeChair] =" & Chr(34) & Me![txtStaff1] & Chr(34) if txtCommitteeChair is text

  3. #3
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: multiple link criteria (2003)

    Hey Pat!

    Expected: End of statement
    occurs at "if"
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: multiple link criteria (2003)

    Sorry about that, I thought it was obvious. Put a ' before the if in both cases. The ' makes the rest of the line a comment.

  5. #5
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: multiple link criteria (2003)

    <img src=/S/rofl.gif border=0 alt=rofl width=15 height=15>
    It is obvious if you're not oblivious!
    That'll teach me for just cutting and pasting without actually LOOKING at the code.

    Thanks Pat, that works perfectly.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

Posting Permissions

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