Me.Visible=False

E

Ernie Sersen

REF: earlier post "Parameter Value in Query"

I tried coding the command button's click event with
Me.Visible=False. When I ran the form and clicked on the
button, it responded "Microsoft Access cannot find the
Macro Me...". The same thing happened when I entered
DoCmd's in the Report Properties Open and Close events
(Microsoft Access cannot find the Macro DoCmd...)

Is there a better way to run these commands?

Thanks
 
B

Brendan Reynolds

To add a command button to a form which, when clicked, will hide the form
....

In form design view, select the command button control from the toolbox and
place it on the form. If a 'Command Button Wizard' dialog opens, click
'Cancel' to close the dialog. Now in the Properties window, on the Other
tab, enter a meaningful name in the 'Name' field. Now switch to the Event
tab in the Properties window, click in the field labelled 'On Click'. A
build button (a button with an ellipsis (...) as its caption) will now
appear to the right of that field. Click the build button. If asked whether
you want to build an expression, a macro, or VBA code, choose VBA code. (I
turned off that prompt on my system a long time ago, I don't remember the
exact wording of the message). You'll be presented with an event procedure
stub that looks something like this ...

Private Sub ButtonName_Click()

End Sub

Where 'ButtonName' is the name you gave the command button. Add your
"Me.Visible = False" line between the "Private Sub ..." and "End Sub" lines
....

Private Sub ButtonName_Click()

Me.Visible = False

End Sub

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

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