Showing or hiding some columns in a query?

  • Thread starter Thread starter danijela.simunovic
  • Start date 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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top