Ok, I have a database with a list of customers.
The main switchboard contains a text box, with a Search button (which is controlled by a macro).
Basically, if I want to find a customer, I put the customer's name in the Text Box, press Search (aka Run Macro) and it opens up a form giving me a list of all customers with that surname.
There's a couple of problems with the above, however and as I have little experience with Access, I am not entirely sure what to do to solve them and would be grateful for any help you can give me.
My Macro is as follows:
OpenForm - Customers <------The form that displays Customer information.
GoToControl - [ContactLastName] <------The field in the table I would like to search, based on what's written in the text box.
FindRecord - =[SurnameSearch] <-------The name of the text box the Macro refers to.
The problems I would like to solve are:
1. If the text box is empty, it opens the form anyway and displays an Action Failed error message. I would like to prevent the Macro from running if the text box is empty, and produce a custom error message (E.g. "Please enter something into the Search box.")
2. If no matching records are found, it does the same as the above, but without an error message. I would like to stop the form opening and simply display an error message saying "No matching records found."
3. For some reason, it only goes to the first matching record and doesn't filter out any records that don't match. How do I get the macro to apply a filter, based on what I've written in the text box?
I hope the above is not too complicated!
Kind Regards,
PT
The main switchboard contains a text box, with a Search button (which is controlled by a macro).
Basically, if I want to find a customer, I put the customer's name in the Text Box, press Search (aka Run Macro) and it opens up a form giving me a list of all customers with that surname.
There's a couple of problems with the above, however and as I have little experience with Access, I am not entirely sure what to do to solve them and would be grateful for any help you can give me.
My Macro is as follows:
OpenForm - Customers <------The form that displays Customer information.
GoToControl - [ContactLastName] <------The field in the table I would like to search, based on what's written in the text box.
FindRecord - =[SurnameSearch] <-------The name of the text box the Macro refers to.
The problems I would like to solve are:
1. If the text box is empty, it opens the form anyway and displays an Action Failed error message. I would like to prevent the Macro from running if the text box is empty, and produce a custom error message (E.g. "Please enter something into the Search box.")
2. If no matching records are found, it does the same as the above, but without an error message. I would like to stop the form opening and simply display an error message saying "No matching records found."
3. For some reason, it only goes to the first matching record and doesn't filter out any records that don't match. How do I get the macro to apply a filter, based on what I've written in the text box?
I hope the above is not too complicated!
Kind Regards,
PT