hiding blank fields in query

KTJ_SBS

Registered User.
Local time
Today, 06:42
Joined
Jan 7, 2005
Messages
11
can you hide a field in a query if the results of that query have a field that has no data within it?

its a parameter query so it could be a different field that needs to be hidden each time

thanks in advance
 
You can't. However, you shouldn't be showing your data in query view. You can manipulate how data appears in a form, but its not obvious under what circumstances you would do this. Could you give us some more information?
 
the result of the query would probably only ever be 1 record so for viewing purposes i just wanted to hide the fields that didnt have anything in them.

looked at creating a form to do this and just displaying as a datasheet but still could see how i could do hide fields that had no data in them.
 
You say 'probably only ever be 1 record'. If there were two records you would have the possibility of blank in one record in the same column as a value in the second, so I don't think that is realistic in datasheet view.

If you made a form in form view, you could manipulate the Visible property of the text boxes using VB. If you change visible to No, then neither the label nor the text box is visible.
 
ok......i might get 1 cell empty and one not so that column I wouldnt want to hide. but I would want a field to be hidden if all cells within it were blank. Is it possible in a query or not? From what you are saying I guess not.


In the design of the form i changed the visible property to 'no' and if i display the form in Datasheet view i still see the empty fields and i have it as a continous form i see none of the fields. i dont know VB so if there is a bit of code that helps me here.......any chance you could tell me?

thanks again for your prompt replies :)
 
No you can't easily 'hide' fields in a query. It would be possible using SQL statements that were created 'on the fly' to only include non blank fields. However, it's not something I've ever wanted to do, so I can't help.

Unfortunately, neither have I needed to play around with the visible property in VBA, so the only way I could help is by prototyping. Pressure at work means this is not going to be possible. Sorry.
 
hiding empty column

Hi KTJ_SBS,

I wanted to do the same thing like this. Have you got any solution? Hope you can share.

thanks.
 
As Neil has already said, you shouldn't use queries for displaying the data. Use the query to extract the data and use a form to display it. You have a lot of scope for changing the appearance if you use a form.
 
hiding data

Hi Rabbie,

Thanks for your prompt reply. Actually I wanted to use the query to create a report. The report will only shown non-blank column including it's header.
Can this be done?

Thanks.
 
Hi Rabbie,

Thanks for your prompt reply. Actually I wanted to use the query to create a report. The report will only shown non-blank column including it's header.
Can this be done?

Thanks.
You can format the report to hide/show any piece of data depending on its content. So provided you know a little VBA you should be able to get what you want.
 

Users who are viewing this thread

Back
Top Bottom