Kaw4Life
Kaw4Life

Reputation: 209

Passing OpenArgs to Form

Main form (tabular) with command button on each record. Clicking on that opens a second form showing details of record clicked.

DoCmd.OpenForm "frm_sub_component", , , , , , Me.sub

Second forms query has ...

HAVING (((tbl_sub.sub)=[forms]![frm_prime_select].[OpenArgs]));

Imideate windows says OpenArgs has the correct vaule but the second form is not picking it up.

Upvotes: 1

Views: 264

Answers (2)

Kaw4Life
Kaw4Life

Reputation: 209

DoCmd.OpenForm "frm_sub_component", , , "sub='" & Me![sub] & "'"

Click event on the main form that opens the sub_form.

Upvotes: 1

Wiz
Wiz

Reputation: 121

I don't know why you use the HAVING clause but normally if you just have a continuous form and you want to see the detail of each record the easiest way to show the detail form is using the filter condition in the DoCmd.OpenForm

Otherwise you can intercept the OpenArgs in the Form_Load event of the details form and process it there. If you want to in that event procedure you can modify the RecordSource property to show what you want.

I prefer this way cause I can always check the code to see what's doing instead of having something hidden behind the scenes:-)

Let me know if the solution is what you are expecting.

Bye, Wiz

Upvotes: 0

Related Questions