zekebar
Nov 12 2009, 12:46 PM
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
Nov 12 2009, 12:52 PM
Try the following:
Me.Detail.Visible = False
Bob_L
Nov 12 2009, 12:54 PM
Don't use the BANG (!) use the dot:
Me.Detail.Visible = False
Bob_L
Nov 12 2009, 12:55 PM
Darn! My computer had locked up because I clicked something I wasn't trying to and I came in second with the answer :(
zekebar
Nov 12 2009, 12:56 PM
I tried that, with the same results.
Any other ideas?
Thank You
Zeke Barlow
Small Electronics
Bob_L
Nov 12 2009, 12:57 PM
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
Nov 12 2009, 12:58 PM
Me.SubformContainerName.Visible = False
zekebar
Nov 12 2009, 12:59 PM
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
Nov 12 2009, 01:01 PM
I tried it exactly how it was recommended above. W/O brackets.
John, What is the SubformContainerName
Thank You
Zeke Barlow
Small Electronics
RAZMaddaz
Nov 12 2009, 01:20 PM
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
Nov 12 2009, 01:24 PM
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
Nov 12 2009, 02:01 PM
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
Nov 12 2009, 02:02 PM
Opps that should be
Me.Detail.Visible = False
Thank You
Zeke Barlow
Small Electronics
Bob_L
Nov 12 2009, 02:07 PM
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
Nov 12 2009, 02:12 PM
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
Nov 12 2009, 02:33 PM
Also, be sure the Allow Additions property is No, otherwise you will get blank controls.
zekebar
Nov 12 2009, 03:09 PM
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
Nov 12 2009, 03:11 PM
Thank You, I am still learning how the forum works. I am grateful for these tips.
Thank You
Zeke Barlow
Small Electronics
zekebar
Nov 12 2009, 03:12 PM
Frank,
I guess I am not sure what you are referring to.
Thank You
Zeke Barlow
Small Electronics
fkegley
Nov 12 2009, 03:16 PM
Try this instead:
Me.Section(acDetail).Visible = False
or
Me.Section(0).Visible = True
zekebar
Nov 12 2009, 03:22 PM
Me.Section(Detail).Visible = False
That did it! ! !
Thank You very much.
Zeke Barlow
Small Electronics
jmcwk
Nov 12 2009, 03:27 PM
You The Man Frank !
RAZMaddaz
Nov 12 2009, 03:28 PM
But why did Zeke have to do that, when You, Me and the rest of the Access World didn't?
RAZ
jmcwk
Nov 12 2009, 03:30 PM
maybe the Version 2.0 ?????
RAZMaddaz
Nov 12 2009, 03:36 PM
That's what I would assume too.
Bob_L
Nov 12 2009, 03:38 PM
Remember, Version 2 didn't use VBA as we know it. It used Macro language.
fkegley
Nov 12 2009, 03:45 PM
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
Nov 12 2009, 03:47 PM
QUOTE
Apparently, the Me.Detail.Visible syntax is accepted, but it just doesn't work.
It works fine for me (2003).
jmcwk
Nov 12 2009, 03:48 PM
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.