check boxes
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

Check boxes

resolvedResolved · High Priority · Version 2003

replyReply Thu 4 Sep 2008, 17:40Delegate Chloe said...

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


For upcoming training course dates see: Pricing & availability

replyReply Fri 26 Sep 2008, 12:04 Edited on Fri 26 Sep 2008, 12:05Trainer Laura said...

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

 

Please browse our web site to find out more about
access courses in london and other Microsoft training courses.

Access tip:

Choosing data types in Access

Not sure which data type to use for your Access fields? Here are some guidelines to help you choose a data type to assign to a field.

- The Text data type can accept up to 255 characters. For information that will be recorded in paragraphs, use Memo.

- Also use Text for numbers that aren't going to be used in calculations, e.g. phone numbers.

- Use the Currency data type for monetary amounts.

- Use Date/Time for dates.

- Most other numbers can use the Number data type, but the Field Size property may have to be altered.

- For fields that have only two alternatives (yes, no) use Yes/No data type. If there is likely to be a third entry option (e.g. maybe or don't know) use Text instead.

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard