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

Passing arguments

Status
Not open for further replies.

goldygirl

Programmer
Jan 16, 2004
33
US
I am working on the applications that pass 2 arguments from Form1 to Form2. I created Form 2 using Access wizard (I created form and subform).

Attached is a code created but Access wizard:

stDocName = "Offer USA"
stLinkCriteria = "[Dtl_ID]=" & Me![Promo]
DoCmd.OpenForm stDocName, , , stLinkCriteria

I need to add 1 more parameters to open Form2. I created something like...
stLinkCriteria = "[Dtl_ID]=" & Me![Promo] & "[Dtl_Name]=' & Me![Text18]"

And I am getting an error that the syntax is not correct :(

Please HELP

Regards,
Goldy
 
stLinkCriteria = "[Dtl_ID]=" & Me![Promo] & " AND [Dtl_Name]=' & Me![Text18] & "'"

John
 
Thanks for your reply.....

I added this code, but now after I selecting a record from form1 I am getting a parameter window, where I have to enter 2nd parameter manually. So if I am entering a parm, I am getting correct info on the second form.
 
I would check on the form that Text18 is the name of the textbox, if not, rename "Text18" to the name of the textbox.
You can find this out by right clicking on it, going to Properties and its name is on the "Other" tab.

John
 
I checked the name is is Text18 :(((
Do you know what shouldd I do to not go get this parameter entry window???

Thanks again for your help:))
 
I checked tha naming of this field -->> it is correct

Again, my question is how to bypass this parameter window?

Thanks
 
Hey GoldyGirl,

I think you are missing a Quote (see sample/red quote).

stLinkCriteria = [blue]"[Dtl_ID]=" & Me![Promo] & " AND [Dtl_Name]='[red]"[blue] & Me![Text18] & "'"
[black]
This is what John's sample was but includes the extra quote.

Good Luck,
Hap [2thumbsup]

Access Developer [pc] Access based Add-on Solutions
Access Consultants forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top