Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.OpenForm have multiple criteria

Status
Not open for further replies.

Ebes1099

Technical User
Jul 8, 2009
156
US
I have a button on my form that opens a different form to a specific record using data from the form where the button was clicked. The problem is that my primary key is a combination of group number and group code. Some group numbers have 2 or 3 group codes. But there is no combination of group number/group code that is a multiple (obviously since it's the primary key). Anyway, when I went through the create button wizard I could only choose 1 field to match. I chose Group Number and sometimes it will bring up the wrong Group Number/Code combo. The auto generated code looks like this...

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Terming"

stLinkCriteria = "[GroupNumber]=" & "'" & Me![GroupNumber] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Can I add something to stLinkCriteria to add the value of the GroupCode field that's on the form too? Or can I make another variable and pass that in the same argument of the DoCmd.OpenForm? Thanks for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top