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

Open a New Form Based on datainput from Another form

Status
Not open for further replies.

SwingXH

Technical User
Jun 15, 2004
97
US
I have a form, mainform, to be used as input form.
Assume I have fileds ID and Name to control the data record on another form, form1.

I used codes like this
stLinkCriteria = "[ID] = " & Me.ID.Value And "Name = " & Me("ComboName").Value

DoCmd.OpenForm stDocName, , , stLinkCriteria

But got type mismatch for And "Name = " & Me("ComboName").Value

Anybody can help?
Thanks a lot!
swingXH
 
Have you tried to replace this:
stLinkCriteria = "[ID] = " & Me.ID.Value And "Name = " & Me("ComboName").Value
by this ?
stLinkCriteria = "[ID] = " & Me.ID.Value And "Name = '" & Me("ComboName").Value & "'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I got type mismatch error.
ID is integer, and Name is text field.
 
looks like i still got type mismatch error when using

"Name = '" & Me("ComboName").Value & "'"

That's strange. Any other idea?
Thanks a lot!
SwingXH
 
when I change both field to numerical fields, i still get the same tyoe mismatch error.

for example
stLinkCriteria = " ID = " & Me.ID.Value And "ID1 = " & Me.ID1.Value

DoCmd.OpenForm "form1", , , stLinkCriteria

Both mainform and form1 have fields ID and ID1.

SwingXH
 
This works,

stLinkCriteria = " ID = " & Me.ID.Value & " And " & "Name = '" & Me("ComboName").Value & "'"

Anybody give me a star:)
Thanks,

SwingXH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top