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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with "' And "'"

Status
Not open for further replies.

ramrags

IS-IT--Management
Aug 17, 2001
62
US
I have a form with a subform and I have a commanf button that is used to open another form called "frmORDERS". This form opens from records from a query called qryORDERS, and I want the query to show the record that I was Working on. So I want to pass the Criteria from the form and subform. The code that I am using is:

Dim stLinkCriteria as String
Dim stDocName as String

stDocName = "frmRES_ORDERS"
stLinkCriteria = "[RegistrationID]= '" & Me.RegistrationID & "' And [ReservationNumber]= '" & Me.ReservationSubform.Form!ReservationNumber & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

This comes back with the error the form action was canceled
when I debug stLinkCriteria is stLinkCriteria= "[RegistrationID]= '1313' And [ReservationNumber]= '4321'"

And these are the correct records that I am working on so the query works but I cant get the form to open.

Thank You for any help
 
I suspect the numbers are numbers, and not text? If so, just remove the single quotes.

Roy-Vidar
 
Thanks that was it I was looking at this too long.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top