I am using VBA\DAO to write new records to a table in a shared database (front-end/back-end), which obviously has multiple users. This database is for scheduling meeting rooms and we are trying to avoid availability conflicts when more than 1 person tries to select a time slot(s) at the same time.
The way it works is, when the form loads, it loads all available slots in the listbox. If 2 users open it prior to the other scheduling the desired slot, they can both see and select the same slots. If one person picks the slots, I want the second person to get an error\msgbox if they pick the same slot(s) stating the slots were already selected. I have most of this taken care of already and works if I write one persons selections and then re-visit the table shortly after, but it seems as if the data isn't being physically written to the table immediately, maybe just sitting in memory.
The table being written to is not bound to a form, it's manipulated only through VBA code. How can I write\save changes to this table immediately after my DAO INSERT INTO query, which is what writes selected time slots to my table so it can be found by my DLookUp call (used to check for already selected slot(s)) within a second or less?
How slots are written to my table:
Code:
CurrentDb.Execute "INSERT INTO Scheduled (UserName,ApptDate,ApptTime,ApptID) VALUES ('" & strUser & "',#" & strDate & "#,#" & arrTimes(lstStart.Column(0, lstStart.ListIndex)) & "#, " & lngApptID & ");"
Thanks!