hide column in query based on form input

B

Ben

Hi,

I'm trying to figure out the vba code that i need to hide a column based on
criteria selected in a form. eg the qry has all the work order information
and i select only open work orders in the form so i want to hide the columns
"closed by" and "closed time" since the work order isn't closed.

Thanks,

Ben
 
J

Jeff Boyce

Ben

While I'm not familiar with a way to programmatically "hide" query columns,
there certainly could be one ... but why?

If you are saying you don't want to see those columns when the selection
criteria result in only "open" work orders, couldn't you just leave those
columns out of your query?

And your description could be interpreted to mean that you are presenting
the users with a query result, rather than displaying the result in a form
or report. If you are opening the query for them, what's to prevent them
from thinking it's a spreadsheet and simply making changes in it?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

Ben

Hi Jeff,

thanks for getting back to me, hopefully this will explain a little bit
better why i want to do this.

In the form view they have the choice to pick either open or closed work
orders so that's why i left them in the query. The reason for the qry
presentation is because i have a subdata sheet that shows all the lines
associated with a work order so that if they want to see more detail on it
without having to open up the actual work order they can, so yes it is
basically a report they are looking at but with a little more flexability.
With that being said yes they could just hide the columns once they run the
qry but I basically just wanted to hide them automaitcally to make it look
cleaner for the end users.

I'm still very new at vba so any help is greatly appreciated.

Thanks again,
 
J

Jeff Boyce

Ben

Here's another option...

Use two queries, one for "open", one for "closed" work orders. After the
user picks one of those, change the query that runs.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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

Top