Full Version: Hiding Detail Section Of A Form
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
zekebar
I am running Access 2.0 and I have two linked combo boxes in the form header that determines the criteria for the information in the detail section of the form. I want to be able to hide the detail section of the form until those combo boxes have been populated. I can hide the detail section in the properties, I am just trying to find out how to do it in VBA. I have tried the Me![Detail].visible = No and it says "Invalid reference to field detail". I tried to use the builder which came up with the same code and same error. Any Ideas?

Thank You
Zeke Barlow
Small Electronics
RAZMaddaz
Try the following:

Me.Detail.Visible = False
Bob_L
Don't use the BANG (!) use the dot:

Me.Detail.Visible = False
Bob_L
Darn! My computer had locked up because I clicked something I wasn't trying to and I came in second with the answer :(
zekebar
I tried that, with the same results.
Any other ideas?

Thank You
Zeke Barlow
Small Electronics
Bob_L
QUOTE
I tried that, with the same results.
Any other ideas?

You did not use square brackets around Detail did you? You should not, if you did.
jmcwk
Me.SubformContainerName.Visible = False
zekebar
Access 2.0 seems to use the (!). When I use the builder that is how it puts it in the code.

Thank You
Zeke Barlow
Small Electronics
zekebar
I tried it exactly how it was recommended above. W/O brackets.

John, What is the SubformContainerName


Thank You
Zeke Barlow
Small Electronics
RAZMaddaz
So after all these suggestions, what do you currently have and what is the error message?

Also, where are the Combo Boxes located? Are they on the Main Form or are they in a Sub Form?
jmcwk
Zeke,

My apologies I misread your original post Subformcontainer name would nave been the name of your subform however that is not what you were after sorry !
zekebar
Me.Detail.Visible = True
Error: "Invalid reference to field 'Detail'."
The combo boxes are located in the form header of the Main Form.

Thank You
Zeke Barlow
Small Electronics
zekebar
Opps that should be
Me.Detail.Visible = False

Thank You
Zeke Barlow
Small Electronics
Bob_L
Make sure that your detail section hasn't had its name changed. Go into design view on the form and then select the detail section and look in the properties to make sure that the NAME still says DETAIL and not some other name. Also, make sure you do not have any fields or objects in your database with the name of DETAIL as well.
jmcwk
Zeke,

Where are you putting your Code ?

Also just an FYI when you reply to a post click the Blue Reply to the right of the post you want to reply to. Otherwise the recepiant may not see it. As you are replying to yourself
fkegley
Also, be sure the Allow Additions property is No, otherwise you will get blank controls.
zekebar
Ok, the detail section is named detail and I don't any fields in the database named detail.

Thank You
Zeke Barlow
Small Electronic
zekebar
Thank You, I am still learning how the forum works. I am grateful for these tips.

Thank You
Zeke Barlow
Small Electronics
zekebar
Frank,
I guess I am not sure what you are referring to.

Thank You
Zeke Barlow
Small Electronics
fkegley
Try this instead:

Me.Section(acDetail).Visible = False

or

Me.Section(0).Visible = True
zekebar
Me.Section(Detail).Visible = False
That did it! ! !
Thank You very much.

Zeke Barlow
Small Electronics
jmcwk
You The Man Frank !
RAZMaddaz
But why did Zeke have to do that, when You, Me and the rest of the Access World didn't?

RAZ
jmcwk
maybe the Version 2.0 ?????
RAZMaddaz
That's what I would assume too.
Bob_L
Remember, Version 2 didn't use VBA as we know it. It used Macro language.
fkegley
I am using version 2007. I vaguely remembered that the way we all tried didn't work. So I tried this syntax:

Me.Section(0).Visible = False

Then opened the help files on the Section keyword.

Apparently, the Me.Detail.Visible syntax is accepted, but it just doesn't work.
Bob_L
QUOTE
Apparently, the Me.Detail.Visible syntax is accepted, but it just doesn't work.

It works fine for me (2003).
jmcwk
07 as well
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.