Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

check boxes

ResolvedVersion 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:

Action queries

Unlike select queries you cannot use action queries as a data source for the use with forms or reports,as they do not return a dataset that can be read.

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.