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

Passing 2 Values from form to form

Status
Not open for further replies.

jmeckley

Programmer
Jul 15, 2002
5,269
US
I need to pass 2 values from 1 form to another. I am passing the date and the name. I have this code below:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "EditEvent_frm"

stLinkCriteria = "[Name]=" & Me![Name] & " [EventDate]=" & "#" & Me![EventDate] & "#"
DoCmd.OpenForm stDocName, , , stLinkCriteria

When I click on the button to open the second form I get this error:

Syntax error (missing operator) in query expression '[Name]=ABC [EventDate]= #01/01/2001#'.

It's been awhile since I've programmed so it's slowly coming back.

thanks for you help Jason Meckley
Database Analyst
WITF
 
Looks like there should be an AND between the 2 criteria.

stLinkCriteria = "[Name]=" & Me![Name] & " AND [EventDate]=" & "#" & Me![EventDate] & "#"
 
adding "AND" to the code did not correct the error. i also added "Where" to the beginning of the criteria and that did not work either. Jason Meckley
Database Analyst
WITF
 
problem sloved! I was missing sinle quotes around the text. (') Jason Meckley
Database Analyst
WITF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top