Roger, thanks a ton for the guidance. I haven't yet tried the code but
logically it makes sense. Actually maybe you can suggest a good VB, VBA or
ACCESS VBA book. I learn best by examples and tutorials. I bought one book
but it is more geared as a reference than instruction manual. I have Office
2003 Pro and Visual Studio.net ver 2003. Again thanks for all of your
assistance.
-John
:
First of all, I suggest that you can replace your macro with the following
code:
Me![subform2].Visible = Not Me![subform2].Visible
As for hiding it from the subform itself, you have to do 2 things:
1) set the focus to the some control on the main form
2) use full referencing rather than the Me object
Therefore, it would look something like this:
Forms!Form1!Command1.SetFocus
Forms!Form1![subform2].Visible = False
In the above, Command1 is the name of the command button used to toggle, but
it can be ANY control on the main form.
--
--Roger Carlson
MS Access MVP
Access Database Samples:
www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
For toggling I have a macro.
Action is SetValue
Item is [subform2].[Visible]
Expression is Not [subform2].[Visible]
to just hide the subform I use this code...
Me![subform2].Visible = False
In the subform I have tried command buttons with code like
Me.Visible = False
but I get a message "you can't close an object that has focus"
I tried to change the focus to form1 and then run the toggle macro but
that
caused another error. As you can probably guess I am OK at taking other
people's code and making it work for me, just not generating my own code.
Thank you again for your assistance.
-John
:
What have you tried? How do you close it from the main form?
--
--Roger Carlson
MS Access MVP
Access Database Samples:
www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
I have a form called [form1] and a subform called [subform2]. I have
a
toggle button on [form1] to hide/display [subform2] but I would like
to
add a
command button to [subform2] that will hide itself. I am assuming
this is
an
option but I just can't seem to get it to work. Any ideas? Thanks
again
to
everyone in advance.
-John