VBA Code with multiple checkbox UI

VBAstump

New member
Local time
Yesterday, 22:35
Joined
Apr 8, 2011
Messages
2
Hello! I am new member of this forum and new to VBA so please forgive my ignorance.

I am attempting to use columns with mulitiple checkboxes in order to give an access form a friendly and adaptable UI. The form is used for choosing what is done to a series of excel reports. Some need to have tabs updated, some need to be printed, or both. Each "checked" checkbox signals and action to be done to that report.

I have successfuly worked with buttons and checkboxes to ensure actions are done when they are clicked or checked, but I don't exactly know how to "nest" my Sub's (attached to checkboxes) into a Loop or IfElse in order for my VBA to see the states of muliple checkboxes and act upon them accordingly. Would someone be able to give me some code suggestions? If further details are needed I will comply.

Sincerely,

Stump
 
I am guessing here about how your form is setup.
I imagine a single record form with 3 checkboxes, and the user can have several different combinations of checkboxes that are checked or unchecked.
Ex 1.
If Me.chkA = True and me.chkB = False and Me.chkC = True Then
‘code to do one action
ElseIf Me.chkA = True and me.chkB = false and Me.chkC = False Then
‘code to do another action
ElseIf ‘choose another combination of chkbox true or false
End If

Ex 2.
Sometimes you can use the absolute value of the checkboxes.
Dim lngN as Long
lngN = abs(Me.chkA) + abs(Me.chkB) + abs(Me.chkC)
Select Case lngN
Case =0
‘code to do something
Case =1
‘code to do something else
Case =2
‘code for another action
Case Else
End Select
 
I think you guessed correctly. The Form has three columns with single row entries (reports) which have the option of having any 1 to 3 checkboxes checked.

I'll try your solution when I have time next week and get back to you. Thank you for your reply :)
 

Users who are viewing this thread

Back
Top Bottom