Showing or hiding some columns in a query?

  • Thread starter danijela.simunovic
  • Start date
D

danijela.simunovic

I would like to make 4 checkboxes on a form which would represent 4
query columns. if the checkbox is checked then the column would be
visible and if the checkbox isn't checked then the column would be
hidden. Could this be done through VB or is there some other way of
doing this?
Thanks!

Danijela
 
A

Arvin Meyer [MVP]

It can be done through VBA something like:

If Me.chkBoxName = True Then
Me.ControlName.Width = 1440
Else
Me.ControlName.Width = 0
End If

Do it for each checkbox. This should be done in both the checkbox's
AfterUpdate event and that event needs to be called or the procedure
duplicated in the form's Current event. The 1440 represents the number of
twips in 1 inch, change that to 557 for the number of twips in a centimeter.
If there are more checkboxes, you might want to loop through them instead of
writing individual If ... Then statements.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Top