check boxes

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Check boxes

Check boxes

resolvedResolved · High Priority · Version 2003

Chloe has attended:
Access VBA course

Check boxes

Hi I have a form which has multiple check boxes. I have a list of labels that are named chkjob1, chkjob2...chkjob6,

I would like to create a function that checks all the check boxes for a job when the label is selected/clicked. so once you click on a the label for the job e.g jobA and hit run the details of the job (jobA) will be passed into the fuction which would have an array that would build the names of check boxes and select the row.

eg

form
if label JobA is selected then
pass jobA into the function ()

Function()

chk & jobA & (i)
= chkJobA1. value = true <name of check box>
repeat for all six check boxes.

Please email me if you do not understand what I mean.
I want a seperate fuction so that it can be used for multiple jobs, without endless code.

Many Thanks

Chloe


Edited on Fri 26 Sep 2008, 12:05

RE: check boxes

Hi Chloe

Thanks for the question.

Because you have named your check boxes in a numeric sequence you can use a for loop to walk through them and populate your array.

    Dim iCounter As Integer
Dim Jobs(4) As Boolean
For iCounter = 1 To 4
Jobs(iCounter) = Me.Controls("chkjob" & iCounter).Value
Next iCounter


I hope that helps.

Laura GB

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Hiding rows and columns

To hide a column or row in Access, you need to minimise the column or row. This can be done by placing your mouse on the right edge of a column, wait for the mouse to change to a double aroow and then drag to minimise the column

View all Access hints and tips


Server loaded in 0.08 secs.