View Full Version : Message Box Cancel/Retry


Mel Henderson
04-05-2002, 07:40 PM
I have a query named UPDATE INVOICE one of the fields is [PLATE NUMBER] I use the following in the criteria for that field, Like [Enter Plate Number]. When I run the query I am prompted to enter a plate number.
I have created a form that is also called UPDATE INVOICE, and use this query as the record source.
I then added a switchboard and used one of the buttons to open my form, if I enter a plate number that is in my data base, I will pull up that record in my form that’s fine but if I enter the wrong plate number I pull up a blank record on my form. I need to bring up a message box that will say “Plate Number is Wrong” and give the user a message box with a Try Again and a Cancel button. If they click on try again they should go back to the [Enter Plate Number window], if they click on Cancel they should go back to the switchboard.
I have tried to use some of the error codes and Dcount codes found on the forum but have had no success. Maybe I was putting it in the wrong place or maybe it was the wrong code for this application.
Thank you for any help you can provide to help with my problem.

Mel

jimbrooking
04-06-2002, 06:04 AM
Couldn't you use a combo box with a rowsource of the valid platenumbers? That way the user wouldn't be able to enter an incorrect plate number.

Mel Henderson
04-06-2002, 04:22 PM
I did not want to do it that way because they could enter a plate numer that has never been entered before, so the message would tell them plate number is wrong or not on file.

Mel

Jonathan Kok
04-08-2002, 10:43 AM
If you use the combobox idea and set the 'Limit to List' property to 'Yes', then you can make use of the 'On Not In List' event to run code that will do whatever you want it to. In your case, you'd get it to run a msgbox asking if the user wants to try again.