Double message box/Open form option

SueBK

Registered User.
Local time
Tomorrow, 04:04
Joined
Apr 2, 2009
Messages
197
I have a form that uses data from a personnel list. If a person's name isn't in the personnel table, you can't use them.

What I want is:
If the person isn't on the list, a message box pop up to say "they're not on the list; check your spelling or add them to the list". One button says "Add personnel", One button says "cancel".

When they click "Add personnel" a 2nd form linked to the personnel table opens for them to add the individual. (The reason is that on Form 01 only the name is shown; in the Personnel table we record other data as well).

I have managed to get the message box :-); I have managed to get it to open the 2nd form. But I haven't managed to get it to give the user the OPTION of opening that form or not.

Ideas?

Oh - and after my message box there's ANOTHER default message about the data not being in the list. Can I turn that off 'cause its rather redundant and confusing.
 
Isn't "Cancel" your option not to open the form??
And I think on your second question, on the default message, that would be setting the warnings to false.... I haven't done too much with setting warnings, but I know the correct syntax is in a few post here.... remember to turn them back on!!! :)
 
I have a form that uses data from a personnel list. If a person's name isn't in the personnel table, you can't use them.

What I want is:
If the person isn't on the list, a message box pop up to say "they're not on the list; check your spelling or add them to the list". One button says "Add personnel", One button says "cancel".

When they click "Add personnel" a 2nd form linked to the personnel table opens for them to add the individual. (The reason is that on Form 01 only the name is shown; in the Personnel table we record other data as well).

I have managed to get the message box :-); I have managed to get it to open the 2nd form. But I haven't managed to get it to give the user the OPTION of opening that form or not.

Sue:

In the messagebox code, you can enter parameters that determine what the box looks like and how it's used.

You can omit all of them and use something like:

msgbox "Hello World"

in which case you just get a popup

If you add some parameters to make it more interesting, you can do something like:



Code:
i = Msgbox ("Would you like to say hello to the world?", vbYesNo + vbQuestion, "Messagebox Demo")
if i = vbYes then
  msgbox "Hello World"
End if

This example should be easy to follow. When entering the code, you'll be prompted by intellisense that helps you enter the right thing in the right place. Do a bit of searching on the different options and you'll be able to have a very flexible messagebox.

The one you probably want would have the parameter of vbOkCancel where I put vbYesNo. A simple if statement like I have will let you determine the user's choice and take appropriate action.

I hope this helps

SHADOW
 

Users who are viewing this thread

Back
Top Bottom