Passing parameters using StLinkCriteria and OpenArgs
Posted on 2007-12-05
If I try this for a "Click" on the Instrument form:
stLinkCriteria = "Me![SerialNo]"
DoCmd.OpenForm "StudentInstrument", , , , acFormAdd, , stLinkCriteria
Then, in StudentInstrument| "Load" Procedure I say
[SerialNo] = Me!OpenArgs
my form is magically pre-filled with the correct instrument Serial Number, I ask for the StudentID and proceed to do all the stuff I need to do to assign a Student to this instrument - just what I want - Except:
1. This does NOT seem to be the way it's supposed to work. When I see examples, people create a COMMAND in stLinkCriteria (with the judicious use of double and single quotes) they make stLinkCriteria to equal "[SerialNo] = 'inst123'" instead of just making it equal "inst123". Why? How is this command processed by the called form?
2. That's what I want to do. From the Student form I want to click "Rent an instrument", go to that same form, pre-fill StudentID, ask for an Instrument, and do the stuff. In order to do this I need stLinkCriteria (which is the same thing as OpenArgs, right?) to equal either, "[SerialNo] = 'inst123'" or "[StudentID] = 'stu456'"