Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search box on switchboard (when data not found)

Status
Not open for further replies.

jabrony76

Technical User
Apr 23, 2001
125
US
Hi everyone,
I have a question about my switchboard search option. My DB is set up with ID# as "duplicates not allowed" field and on the main switchboard I have an Unbound box and a command button which opens up the main form on the basis of what is filled into the unbound box. Pretty simple up to this point.
My question pertains to when the ID# is not found. Currently when it is not found, the main form opens up with no data entered into any of the fields. This is a problem because I have a specific intake form where a new entry is to be added. Is there a way to prompt the user with a msgbox or something that will let them know that the ID# was not found and they need to fill out an Intake Form without going through the hassle of the main form opening up blank, having to close it, and having to open the intake form?

basically I want the following work flow:
enter ID#
|
if found open main form based on ID#
|
if not found, msgbox telling user not found without opening main form

I'm using Access 97 for this and I don't know much at all about coding. Most of the stuff I do is through Macros and Expressions. Please Help!!!
Thanks,
Andy
 
In the code of your button use some code that counts the # of records for that ID to determine which form to open combined with an if statement like so:

[tt]
If DCount("[ID#]","MyTable","[ID#]=[MyComboBox]")= 1 then
DoCmd.OpenForm "MyFormNameWhereIDExists"
Else
DoCmd.OpenForm "MyFormNameWhereIDDoesNotExist"
End If
[/tt]

Hope that helps!


Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top