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!

need format for using stlinkcriteria using 4 keys

Status
Not open for further replies.

punky

Programmer
Mar 21, 2001
29
US
I took the next example off this site but is does not work.
Can someone tell me how to string 4 keys together to make the stlinkcriteria work. I do not know what double quotes go with what single quotes and so on.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Second Form"

stLinkCriteria = "[FirstName]=" & "'" & Me![FirstName] & "' AND [LastName] = '" & Me![LastName] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.Close acForm, "First Form"
----------------------------------------
 
The code looks ok. What happens when you try it? Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
HI ToeShot,
I finally got the stlinkcriteria to work for two criteria, but I do not know how to extend it to four criteria. The following works great, but I am still not sure about the groupings between the double and single quotes. Obviously, if I take enough time I will figure it out, but I have run short on patience with it.

Dim stDocName As String
Dim stLinkCriteria As String

iID = [Forms]![frm_1EqipPg2]![EQ1ID]
aArea = [Forms]![frm_1EqipPg2]![EQ1AREA]
dDept = [Forms]![frm_1EqipPg2]![EQ1Dept]
tTruck = [Forms]![frm_1EqipPg2]![EQ1TruckID]

'next statement will find record or create one if
' it does not exist.
stLinkCriteria = "[NYSPGenDept]=" & "'" & Me![EQ1Dept] & "' AND [NYSEQ1TruckID] = '" & Me![EQ1TruckID] & "'"

stDocName = "frm_NYSPortGens"
DoCmd.OpenForm stDocName, , , stLinkCriteria
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top