View Full Version : On Open Event Procedure


MarionD
03-24-2001, 07:21 AM
Hi all,
1.)I have a Form to enter prescriptions. In the on Open event I have the code : docmd.gotorecord,,acnewrec. I want the Form to open with a clean sheet for entry but they should be able to page back. (the forms Data Entry property is set to no). This all works fine.

2.) I have designed a form based on a query that shows all prescriptions entered. Now I want the user to be able to dbl click on the patient prescription number and the original Prescription Form to open with the correct prescription.
Docmd.Openform "formname",acnormal,,"[Field]=" & thisfield.

3. When the Form (under 1.) opens it runs the on open code and goes to a new rec. If I page back 1, the prescription I asked for is there.

Question:
How can I tell this dumb form that if it's opened from the query form it shouldn't go to a new record, but to the one I specify, and if it's opened from the Menu, it should goto a new record?

Pat Hartman
03-24-2001, 09:36 AM
Use the OpenArgs property to pass a parameter to the form. When the form opens, it needs to check the parameter and act accordingly.

MarionD
03-24-2001, 10:50 AM
Thanks Pat,

Never to old to learn!

Do you also usually work on a Saturday night - or isn't it Saturday night where you are?

Marion