Access 2007 Display a Search Result Message after input in text box

StillLearningAccess

New Member
Joined
Oct 24, 2010
Messages
3
I hope that I do not make this sound confusing. What I have created currently works but I would like to improve it.
I have created 2 tables Table 1 and a Table 2, In Table 1 is only one
field "Last Name" and is a text field. Table 2 is a populated database with information and one of the fields is also called
"Last Name". I created a form using the table with the single field "Last Name" in it I created an unbound text box.
and from a query I created (using table 2 all the data I wanted to show on my subform) once the text box has a name typed in the blank
text box on the form it matchs the database and displays any information that matchs the input of the text box. form1 and the subform are links by the last name field.

I can type a name into the empty text box and hit enter, it searches table 2 and displays the results in the subform below.

My question/problem is that when a name is typed in which is not in the database it just sits there (the form). I would like
to create a message box that displays a message There is no matching data please try again. This message box
should have an OK button to return back to the original form. Is this possible? I know very little about programing
VBA but am willing to learn I just do not know where to look. Do I create a message box and link it to the text box, the search button or the subform since it looks through all the data to find results? any help will be greatly appreciated.

Robert
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I hope that I do not make this sound confusing. What I have created currently works but I would like to improve it.
I have created 2 tables Table 1 and a Table 2, In Table 1 is only one
field "Last Name" and is a text field. Table 2 is a populated database with information and one of the fields is also called
"Last Name". I created a form using the table with the single field "Last Name" in it I created an unbound text box.
and from a query I created (using table 2 all the data I wanted to show on my subform) once the text box has a name typed in the blank
text box on the form it matchs the database and displays any information that matchs the input of the text box. form1 and the subform are linked by the last name field.

I can type a name into the empty text box and hit enter, it searches table 2 and displays the results in the subform below.

My question/problem is that when a name is typed in which is not in the database it just sits there (the form). I would like
to create a message box that displays a message There is no matching data please try again. This message box
should have an OK button to return back to the original form. Is this possible? I know very little about programing
VBA but am willing to learn I just do not know where to look. Do I create a message box and link it to the text box, the search button or the subform since it looks through all the data to find results? any help will be greatly appreciated.

Robert
Is this too hard to do??
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top