Creating Custom Messages

CETInnovator

Registered User.
Local time
Today, 09:37
Joined
Oct 11, 2012
Messages
11
I have a macro in a form, that prompts me to enter the name of a company. Once I enter the name of the company, it returns the contact information of the person who manages the account. However, if I incorrectly spell a name or enter in a name that is not in the table, I receive a blank form.

How can I tell my query, that if the information that is typed in the prompt is not there, to return a message that instructs the user that the information is not available and they should try a new search.

Is this possible? and should this be in my query or form?
 
I have a macro in a form, that prompts me to enter the name of a company. Once I enter the name of the company, it returns the contact information of the person who manages the account. However, if I incorrectly spell a name or enter in a name that is not in the table, I receive a blank form.

How can I tell my query, that if the information that is typed in the prompt is not there, to return a message that instructs the user that the information is not available and they should try a new search.

Is this possible? and should this be in my query or form?
Use an input form for inputs. Don't have a macro pop up an input box, use a form to either type in the value or in this case you could use a combo box which would narrow down the selection to only those in the table and then you set the Auto Expand property of the combo and it will get you to the one you want as you type.
 
thanks for the quick response, but the form is working exactly the way that I need it to. What I would also like to include is a message, so that if the user enters a name that is not in the database, they receive a message that says something like " You have entered an incorrect name, please try your search again"

Is there a way to add that message to my parameter in my query, form or macro?
 
thanks for the quick response, but the form is working exactly the way that I need it to. What I would also like to include is a message, so that if the user enters a name that is not in the database, they receive a message that says something like " You have entered an incorrect name, please try your search again"

Is there a way to add that message to my parameter in my query, form or macro?

If you have a button that opens up the query you can use
Code:
If DCount("*", "TableNameHereInQuotes", "[FieldNameHere]=" & Chr(34) & Me.YourControlNameHere & Chr(34)) = 0 Then
   Msgbox "No records found for that entry, please try your search again.", vbInformation
   Exit Sub
End If
 

Users who are viewing this thread

Back
Top Bottom