Multiple stringlink criteria?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to ue a command button to open a form to a record defined by 2
criteria. But I can't seem to figure out how to write the code for both
criteria. Each of the following work individually, but not together as I have
written it:

stLinkCriteria = "[nRstAtt]=" & Me![List5]
stLinkCriteria2 = "[nRstCls]=" & Me![List3]
DoCmd.OpenForm stDocName, , , stLinkCriteria & stLinkCriteria2

So obviously my ampersand in the last line isn't getting it done. ANy help
would be appreciated. Thanks!
 
I want to ue a command button to open a form to a record defined by 2
criteria. But I can't seem to figure out how to write the code for both
criteria. Each of the following work individually, but not together as I have
written it:

stLinkCriteria = "[nRstAtt]=" & Me![List5]
stLinkCriteria2 = "[nRstCls]=" & Me![List3]
DoCmd.OpenForm stDocName, , , stLinkCriteria & stLinkCriteria2

So obviously my ampersand in the last line isn't getting it done. ANy help
would be appreciated. Thanks!

You're confusing the ampersand with the 'AND' operator.
They're diffenrent.

stLinkCriteria = "[nRstAtt]= " & Me![List5] & " AND [nRstCls]= " &
Me![List3]

DoCmd.OpenForm stDocName, , , stLinkCriteria

The above assumes both [nRstAtt] and [nRstCls] are Number datatypes
and that the bound column of both list boxes is a Number.
 
Back
Top