NewbieQ: MsgBox on Form Open 
Author Message
 NewbieQ: MsgBox on Form Open

Hi All, probably a pretty 'simple' question, so please
bear with me...

I would like Access to display a Message Box with a short
message (Some instructions/Contact Info) when a specific
form is opened.  It would only have an 'OK' button and
should open every time the specific Form is opened.

If I understand it correctly, I want to write an event
procedure in the 'On Open' line of the Form Properties,
but I am just getting introduced to VB, so if anyone
could hold my hand a bit here and walk me through this,
I'd very much appreciate it.

Thanks for taking the time to read and/or reply,

Hayle



Thu, 28 Jul 2005 12:37:43 GMT  
 NewbieQ: MsgBox on Form Open
Private Sub Form_Open(Cancel As Integer)
MsgBox "Your instructions and message go here.", vbOk + vbInformation,
"Title of the Box"
End Sub

--
       Ken Snell
<MS ACCESS MVP>


Quote:
> Hi All, probably a pretty 'simple' question, so please
> bear with me...

> I would like Access to display a Message Box with a short
> message (Some instructions/Contact Info) when a specific
> form is opened.  It would only have an 'OK' button and
> should open every time the specific Form is opened.

> If I understand it correctly, I want to write an event
> procedure in the 'On Open' line of the Form Properties,
> but I am just getting introduced to VB, so if anyone
> could hold my hand a bit here and walk me through this,
> I'd very much appreciate it.

> Thanks for taking the time to read and/or reply,

> Hayle



Thu, 28 Jul 2005 13:12:39 GMT  
 NewbieQ: MsgBox on Form Open
Hi Ken, thanks for the quick response! :)

I entered the text as you submitted, substituting my
Dialogue and Msg Box name, and now recieve this error
when I try to open the form:

"The expression On Open you entered as the event property
setting produced the following error: Ambigous name
detected:Form_Open.
*The expression may not result in the name of a macro,
the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function,
event or macro"

Does this mean I need to reference the specific Form Name
instead of just 'Form_Open'?  Some of the other strings
already in the VB Window reference the form using just
the Form_Open line so I don't quite understand why it
isn't working.

Any advice would be appreciated, thanks again!
Hayle

Quote:
>-----Original Message-----
>Private Sub Form_Open(Cancel As Integer)
>MsgBox "Your instructions and message go here.", vbOk +
vbInformation,
>"Title of the Box"
>End Sub

>--
>       Ken Snell
><MS ACCESS MVP>



>> Hi All, probably a pretty 'simple' question, so please
>> bear with me...

>> I would like Access to display a Message Box with a
short
>> message (Some instructions/Contact Info) when a
specific
>> form is opened.  It would only have an 'OK' button and
>> should open every time the specific Form is opened.

>> If I understand it correctly, I want to write an event
>> procedure in the 'On Open' line of the Form Properties,
>> but I am just getting introduced to VB, so if anyone
>> could hold my hand a bit here and walk me through this,
>> I'd very much appreciate it.

>> Thanks for taking the time to read and/or reply,

>> Hayle

>.



Thu, 28 Jul 2005 13:31:13 GMT  
 NewbieQ: MsgBox on Form Open
It sounds as if that form may have already had a Form_Open routine. If so,
you should have just added the message box code to the routine that was
already there.

--
Wayne Morgan
Microsoft Access MVP


Quote:
> Hi Ken, thanks for the quick response! :)

> I entered the text as you submitted, substituting my
> Dialogue and Msg Box name, and now recieve this error
> when I try to open the form:

> "The expression On Open you entered as the event property
> setting produced the following error: Ambigous name
> detected:Form_Open.
> *The expression may not result in the name of a macro,
> the name of a user-defined function, or [Event Procedure].
> *There may have been an error evaluating the function,
> event or macro"

> Does this mean I need to reference the specific Form Name
> instead of just 'Form_Open'?  Some of the other strings
> already in the VB Window reference the form using just
> the Form_Open line so I don't quite understand why it
> isn't working.

> Any advice would be appreciated, thanks again!
> Hayle

> >-----Original Message-----
> >Private Sub Form_Open(Cancel As Integer)
> >MsgBox "Your instructions and message go here.", vbOk +
> vbInformation,
> >"Title of the Box"
> >End Sub

> >--
> >       Ken Snell
> ><MS ACCESS MVP>



> >> Hi All, probably a pretty 'simple' question, so please
> >> bear with me...

> >> I would like Access to display a Message Box with a
> short
> >> message (Some instructions/Contact Info) when a
> specific
> >> form is opened.  It would only have an 'OK' button and
> >> should open every time the specific Form is opened.

> >> If I understand it correctly, I want to write an event
> >> procedure in the 'On Open' line of the Form Properties,
> >> but I am just getting introduced to VB, so if anyone
> >> could hold my hand a bit here and walk me through this,
> >> I'd very much appreciate it.

> >> Thanks for taking the time to read and/or reply,

> >> Hayle

> >.



Thu, 28 Jul 2005 13:51:06 GMT  
 NewbieQ: MsgBox on Form Open
You can have only one instance of the Form_Open subroutine in the form's
module.

Copy the MsgBox line and then delete the code that I'd given you.

Scroll up/down to the Form_Open subroutine that's already there and paste
the MsgBox line into that subroutine (make it the last line before the End
Sub).

If you still have more than one Form_Open procedure, delete all but one. You
can move the code from these others into the one first.
--
       Ken Snell
<MS ACCESS MVP>


Quote:
> Hi Ken, thanks for the quick response! :)

> I entered the text as you submitted, substituting my
> Dialogue and Msg Box name, and now recieve this error
> when I try to open the form:

> "The expression On Open you entered as the event property
> setting produced the following error: Ambigous name
> detected:Form_Open.
> *The expression may not result in the name of a macro,
> the name of a user-defined function, or [Event Procedure].
> *There may have been an error evaluating the function,
> event or macro"

> Does this mean I need to reference the specific Form Name
> instead of just 'Form_Open'?  Some of the other strings
> already in the VB Window reference the form using just
> the Form_Open line so I don't quite understand why it
> isn't working.

> Any advice would be appreciated, thanks again!
> Hayle

> >-----Original Message-----
> >Private Sub Form_Open(Cancel As Integer)
> >MsgBox "Your instructions and message go here.", vbOk +
> vbInformation,
> >"Title of the Box"
> >End Sub

> >--
> >       Ken Snell
> ><MS ACCESS MVP>



> >> Hi All, probably a pretty 'simple' question, so please
> >> bear with me...

> >> I would like Access to display a Message Box with a
> short
> >> message (Some instructions/Contact Info) when a
> specific
> >> form is opened.  It would only have an 'OK' button and
> >> should open every time the specific Form is opened.

> >> If I understand it correctly, I want to write an event
> >> procedure in the 'On Open' line of the Form Properties,
> >> but I am just getting introduced to VB, so if anyone
> >> could hold my hand a bit here and walk me through this,
> >> I'd very much appreciate it.

> >> Thanks for taking the time to read and/or reply,

> >> Hayle

> >.



Thu, 28 Jul 2005 13:50:52 GMT  
 NewbieQ: MsgBox on Form Open
On second thought, the Property sheet for the form should say [Event
Procedure] for the Open event, did you put "Form_Open" in there instead? If
so, click the down arrow to the right of the box and select [Event
Procedure] then click the "..." button next to the arrow button and it will
take you to the event procedure where you add the code that Ken gave you.

--
Wayne Morgan
Microsoft Access MVP


Quote:
> Hi Ken, thanks for the quick response! :)

> I entered the text as you submitted, substituting my
> Dialogue and Msg Box name, and now recieve this error
> when I try to open the form:

> "The expression On Open you entered as the event property
> setting produced the following error: Ambigous name
> detected:Form_Open.
> *The expression may not result in the name of a macro,
> the name of a user-defined function, or [Event Procedure].
> *There may have been an error evaluating the function,
> event or macro"

> Does this mean I need to reference the specific Form Name
> instead of just 'Form_Open'?  Some of the other strings
> already in the VB Window reference the form using just
> the Form_Open line so I don't quite understand why it
> isn't working.

> Any advice would be appreciated, thanks again!
> Hayle

> >-----Original Message-----
> >Private Sub Form_Open(Cancel As Integer)
> >MsgBox "Your instructions and message go here.", vbOk +
> vbInformation,
> >"Title of the Box"
> >End Sub

> >--
> >       Ken Snell
> ><MS ACCESS MVP>



> >> Hi All, probably a pretty 'simple' question, so please
> >> bear with me...

> >> I would like Access to display a Message Box with a
> short
> >> message (Some instructions/Contact Info) when a
> specific
> >> form is opened.  It would only have an 'OK' button and
> >> should open every time the specific Form is opened.

> >> If I understand it correctly, I want to write an event
> >> procedure in the 'On Open' line of the Form Properties,
> >> but I am just getting introduced to VB, so if anyone
> >> could hold my hand a bit here and walk me through this,
> >> I'd very much appreciate it.

> >> Thanks for taking the time to read and/or reply,

> >> Hayle

> >.



Thu, 28 Jul 2005 13:54:31 GMT  
 NewbieQ: MsgBox on Form Open
Many thanks Gents, that got me fixed right up! :)

Any advice on where to start if one wanted to learn from
the ground up on VB in Access?

As you can Obviously tell, I'm pretty basic in this
field, perhaps one of the 'Dummies' series of books, or
can you recommend something?

Thanks again!
Hayle

Quote:
>-----Original Message-----
>Hi Ken, thanks for the quick response! :)

>I entered the text as you submitted, substituting my
>Dialogue and Msg Box name, and now recieve this error
>when I try to open the form:

>"The expression On Open you entered as the event
property
>setting produced the following error: Ambigous name
>detected:Form_Open.
>*The expression may not result in the name of a macro,
>the name of a user-defined function, or [Event
Procedure].
>*There may have been an error evaluating the function,
>event or macro"

>Does this mean I need to reference the specific Form
Name
>instead of just 'Form_Open'?  Some of the other strings
>already in the VB Window reference the form using just
>the Form_Open line so I don't quite understand why it
>isn't working.

>Any advice would be appreciated, thanks again!
>Hayle

>>-----Original Message-----
>>Private Sub Form_Open(Cancel As Integer)
>>MsgBox "Your instructions and message go here.", vbOk +
>vbInformation,
>>"Title of the Box"
>>End Sub

>>--
>>       Ken Snell
>><MS ACCESS MVP>



>>> Hi All, probably a pretty 'simple' question, so please
>>> bear with me...

>>> I would like Access to display a Message Box with a
>short
>>> message (Some instructions/Contact Info) when a
>specific
>>> form is opened.  It would only have an 'OK' button and
>>> should open every time the specific Form is opened.

>>> If I understand it correctly, I want to write an event
>>> procedure in the 'On Open' line of the Form
Properties,
>>> but I am just getting introduced to VB, so if anyone
>>> could hold my hand a bit here and walk me through
this,
>>> I'd very much appreciate it.

>>> Thanks for taking the time to read and/or reply,

>>> Hayle

>>.

>.



Thu, 28 Jul 2005 14:07:43 GMT  
 NewbieQ: MsgBox on Form Open

Quote:
> Any advice on where to start if one wanted to learn from
> the ground up on VB in Access?

> As you can Obviously tell, I'm pretty basic in this
> field, perhaps one of the 'Dummies' series of books, or
> can you recommend something?

Access Developer's Handbook. Litwin et al.

It's not "dummy," but neither is Access. You can copy and paste from the
book without knowing the details at first, then gradually learn how it does
what it does.

I think combining that book (those 2 volumes now) with real-world projects
you can learn VBA/Access faster than with a book directly aimed at
beginners. You don't want to stay "basic" for long: seeing what Access can
do when taken to its limits will help you see its potential for day to day
projects.

HTH,

Max
www.siliconpublishing.com
\



Thu, 28 Jul 2005 17:21:02 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. NewbieQ: capturing form size and position?

2. Form hides when Msgbox opens

3. Open form, close form, open form = disposed object exception

4. Opening a form when another form is opened

5. Should everything a Class Module? NewbieQ

6. NewbieQ: Where to store private data?

7. NewbieQ - Accessing controlls

8. NewbieQ: Managing multiple interfaces

9. NewbieQ: Accessing HTML files from a Text box..

10. NewbieQ - Moving a loaded mesh

11. MsgBox - want to open automatically with file

12. MsgBox do the always open in the middle?

 

 
Powered by phpBB® Forum Software