VBA Question about forms

G

Guest

Good morning,

I am using a Access VBA module and would like to print out documents based
on user selected check boxes on 2 different forms. I had a single form setup
and I've got my VBA commands for the first form working, but I had to split
that form into 2 forms and now I don't know how to reference checkboxes on my
second form. I am using If statements to see if a box is checked or not. I
need a VBA way to reference any checkboxes on my second form also. I am
curious if I need
to use like: IF Forms!Formname Checkboxname = TRUE Then" format, or what? I
could use an example of an If statement for a checkbox on formA and a
checkbox on formB? Any suggestions, Thanks.

Cordially,
 
S

Sergey Poberezovskiy

I assume that you call your VBA module in response to a
CommandButton click on your form(s). Then just pass into
the VBA module the reference to your form (or even
checkBoxes):
1 choice
MyVBAProcedure Me

and in the module

Public Sub MyVBAProcedure(ByVal frm As Form)
If frm!check1 Then ...
End Sub

1 choice
MyVBAProcedure Me!check1

and in the module

Public Sub MyVBAProcedure(ByVal chk As CheckBox)
If chk Then ...
End Sub

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top