Create Message Box to pop up Conditionally upon Opening Form

L

LisaR

Hi,

I have a database that tracks info on Counselor phone calls with a particular
Client. Upon opening the input form, the User/Counselor is prompted to enter
a Client ID Number. The form then queries for the given Client ID Number and
displays that Client's info on the input form. If the given Client ID Number
is not found, then the query just opens the form with a blank new record. I
have created an input box , which prompts the user for the Client ID Number
they'd like to find, and the input box appears when the form is opening.

The User/Counselor will have no need to create a new record. Also, being they
are on a fast paced call when inputing into the form, they're easily unaware
that the Client ID Number they have given didn't pull up an existing record.
I have figured out how to create a message box which notifies the User that
the given Client ID Number was not found, but only after the User is closing
the form (via a button I created) or querying the next Client ID Number (also
via a button I Created). My problem with this is that by that point the User
has created a new Client record with phone call info, but no Client ID Number.
Even if they enter in the Client ID Number on the new Client record, it will
just be creating a duplicate.

I would like to have a message box that appears immediately after the Client
ID Number given in the input box isn't found. I have tried changiing the
properties on the form to not allow additions, but this is too User un-
friendly for the Counselor. They will likely think there is an error with the
database, and will have to close the form and re-open it to be prompted for a
Client ID Number again. That adds too many steps to for the Counselor while
they are on the phone.

I have tried creating a message box that appears upon open, or upon load, or
upon activate, but I haven't gotten it to work properly. Can anyone give me
some help?

LisaR
 
G

Guest

Hi Lisa

You can use your before/after update event on the txtbox for entering the
ClientID. Try inserting this code into one of those...



If IsNull(DLookup("ClientID", "tblName", "ClientID =' " & YourTxtBoxName & "
' "))_
Then
Msgbox("Your message")
End If


What this will do is look up the value entered and see if it exists in your
client table "tblName" . If it does not exist, your message box will pop up.


Cheers
 
L

LisaR via AccessMonster.com

Hi Paul,

Thanks for the help; but it doesn't solve my problem. My Input Box that asks
the user for a ClientID is not in the VB code of the form, it is in the query
that is called when the form is opened. Even when I tried to get any message
box to appear for any reason, I wasn't able to get it to work.
Hi Lisa

You can use your before/after update event on the txtbox for entering the
ClientID. Try inserting this code into one of those...

If IsNull(DLookup("ClientID", "tblName", "ClientID =' " & YourTxtBoxName & "
' "))_
Then
Msgbox("Your message")
End If

What this will do is look up the value entered and see if it exists in your
client table "tblName" . If it does not exist, your message box will pop up.

Cheers
[quoted text clipped - 30 lines]
 
R

Ron2005

The problem is that the query is trying to load before you get to your
part.

Is, what you have created, actually using the msgbox or are you
creating a psuedo msgbox form. If it is your creation, then whereever
you are calling this form, have it call your msgbox form instead, and
then on the oK on your form have it call the original form and have the
constraint on the query point to your msgbox form instead of a generic
[enter an ID]. Then on the close of this finally called form have it
issue docmd.close "msgboxformname" and then docmd.close
 

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