Autofill parameter in access (1 Viewer)


New member
Jun 8, 2024
Is there any way to autofill parameter ?!
I have a continous form "A" that contain
Id / name
i have create a button to copy id and go to another form "B" (single) that give you all info about this ID
But didn't find a way to auto fill the parameter for the single form

The button that i create is in a continous form so the record i choose will copy his id :

DoCmd.runcommand acCmdcopy
DoCmd.RunCommqnd acCmdClosewindow
DoCmd.openform "B"
1. acCmdcopy takes the existing record and copies the record content except for any autonumber - which is given the next available number. If Id is your primary key then I am unsure of why you do this.
2 DoCmd.openform "B" opens that form with no filter - if your intent is to open it at the record with the current ID, then set a variable to the ID (say intfrmBID = me.ID) on click and the use that in the DoCmd.openform "B", , , "yourcontrolonformBforID = " & intfrmBID
1. You can open the form using the where parameter with criteria.
2. You can pass the ID in as OpenArgs and then Find the record/set the control.
3. You can refer to form B from form A and then set the controls as needed from Form A.

1 & 3 involve code in Form A, 2 is code in Form B.

This was asked recently and option 3 was added by @cheekybuddha, but I cannot find the post now. :-(
Can anyone try it on the database that i attach.

Try *ral* in parameter when loading formA

And thank you for your help


Removed the criteria in the query supporting FormB (not needed)
Adjusted as per post #2


In that case you could use a text control (in the footer?) to allow entry of an ID that is NOT tied to a particular record on formA - that on entry of a valid value (note - need to check to only accept legitimate values), opens FormB with that value ... in the same way as for the buttons on the records in formA. Still no need for a parameter on the query.

Users who are viewing this thread

Top Bottom