Run query on Click Event?

Paulfakins

New Member
Joined
Oct 9, 2003
Messages
29
Still new at this, but I'm giving it my best.

I have built a form for entering appointments. I have disabled the record navigation bars and placed a button on the form to "schedule appointment". I would like to change the event procedure to check for duplicate appointment times with the same employeeID and generate an error message if there is a conflict. If no conflict, add the record and continue.

Any help would be appreciated :pray:
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You can do this a number of ways, the easiest (albeit not the prettiest) way is just to go to the underlying table that the data is stored in and, in the properties of the field, set Indexed to Yes (No Duplicates).
 
Upvote 0
Thanks,

I created a composite index using employee ID, Appt Date, & Appt Time fields and set for no duplicates. This prevents creating multiple appointments for the same employee at the same time.

You are right that this is not the prettiest method, as the error message generated is faitly generic.

How might I go about either changing the error message or possibly checking for duplicates with VBA and generating my own message?
 
Upvote 0
Thanks Denis!

Great link. I looked at it briefly and it seems to be exactly what I am looking for. I don't mind the work involved if the finished product works as I want it to.

Paul
 
Upvote 0

Forum statistics

Threads
1,221,683
Messages
6,161,264
Members
451,692
Latest member
jmaskin

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