Multiple criteria on StLinkCriteria

Joined
Jun 29, 2012
Messages
1
Reaction score
0
Hello,

I created a table-based form that contains a button that opens other form. I want that the new form keep the user id and the visit number (both text boxes with numbers)

I typed the following code, but I get "Type Mismatch":


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "VISIT"

stLinkCriteria = "[User_Id]=" & Me![User_Id] And "[visit_number] =" & Me![visit_number]
DoCmd.OpenForm stDocName, , , stLinkCriteria


I've also tried this but Access asks me the visit number


stLinkCriteria = "([User_Id]=" & Me![User_Id] & ") And ([visit_number] =" & Me![visit_number] & ")"



Does anybody know can I solve this?

Thank you in advance for your help

Irene
 
hi irene
i have the same problem you have and few min ago i found the solution
i will be glad to help you if you still need it
any way
here is your sentence
stLinkCriteria = "[User_Id]=" & Me![User_Id] &"And"& "[visit_number] =" & Me![visit_number]

all i did is putting and between " to be inside the criteria
i hope you will read this
and you can email me any time
thanx
bye
 
Back
Top