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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To: Search for a value using an unbound text box.

Status
Not open for further replies.

I50

Technical User
Jul 27, 2001
7
US

Hello Everyone,

I have a form that I set up as a dialog form that has one unbound textbox use to
receive a value. Once the value has been entered into the unbound textbox I than
use a macro with the following commands that will allow me to open the form for
the matching record:

Macro Condition: Macro Action:

IsNull ([txtValue]) Msgbox
... StopMacro
Openform


Action Arguments:
OpenWhere: [txtValue]=Forms.[frmInput].[txtValue]

However, the problem with this is that when there is no matching record I get a blank
screen, or a blank form. How can I set this process up to display a message that notifies the user with a message that says "NO Record Found" , if there's no match found in the database.

I need some help on this one. can someone help me, thanks.
message that says "
 
Instead of using a macro, you should set this up as a command button on your dialog form. You can then put code in the click event of the button like this:

Dim linkCriteria as string

If isnull(me!txtvalue) then
msgbox "Must enter a value"
else
linkCriteria = "where [somefield] = " & me!txtvalue
docmd.openform "formname",,,linkCriteria
end if
 
Thanks Maguis.

I take it that the Msgbox will follow right after the " end If " statement. True.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top