Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create large Checkboxes, a second method

How to

How to create large Checkboxes, a second method

by  jedel  Posted    (Edited  )
After reading some FAQs on this subject, it got me to thinking of a method that I can use to query and sort records by using the check box as well. Here's how I would do it, not that any other method is wrong, or that my method is better, It's just another angle:

1. Create a field in your table and call it ChkField (or something you can relate to)

2. In your form place the field where you wnat to put it and change the font type to "MonoType Sorts". This is important as we use the characters "4" and "8" which represent a Tick and a cross respectively. Also, change the Tab Stop to "No"

3. Create a command button on your form and make it transparent. call it "CmdFocus".

4. Now, in the "on Click" event of the field, place the code below:

Code:
Dim lgRed, lgGreen As Long

lgRed = RGB(200, 29, 4)
lgGreen = RGB(70, 150, 56)

If Me.ChkField= "4" Then
Me.ChkField= "8"
Me.ChkField.ForeColor = lgRed
Me.cmdFocus.SetFocus
Else
Me.ChkField= "4"
Me.ChkField.ForeColor = lgGreen
Me.cmdFocus.SetFocus
End If

Each time you click on the field, it changes between a tick and a cross and puts the focus back to the CmdFocus button to stop anyone from typing anything else in the field. You can now sort records out by querying all records with either a 4 or an 8 in this field. There is some colour there for bells and whistles, but you can get rid of that if you like.

I need to do some more testing on this, but it seems to work fine
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top