Chg yes/no field when the form is opened.

D

didan

I have a form with a field that shows record in use yes/no. The default
value is set to no. I would like a simple way to have the field change
to yes when the user opens the form and to have that record lock at the
same time just for that user.

Any help on this would be greatly appreciated.... thanks
 
R

Rick B

Not sure why you'd want to set a field. Locking the record is handled in
the Tools/Options. There is a place there to set up your record locking.

As far as setting the check box, that really does not work. If you open a
record and set the checkbox to "y" then you must save the record so others
will see that yes (although if it is locked, they will not be able to see
it) Then, the record would be modified by the user. Once they are done and
they save it, you'd need to change the checkbox to a no. In other words,
you would have to save the record after they opened it and then change the
field to a "no" as the record was again saved. All for not - since the
record would be locked.
 
D

didan

Thank you for your quick response. Better to query on start time not a
yes/no field.

I am trying to fix the start of a database to track the time it takes
a customer to go thru our process. We have a receptionist that logs
the time of arrival. As the customer goes thru each station we need to
track the amount of time at each station. We have four stations. At
station one we have 6 employees ready to grab the next available
customer.

First problem is how to make sure employee #1 and #2 do not pull up the
same customer. Originally I created a query using the lock field to
pull up the waiting customers. The employee #1 clicks a button which
has code to pull up the first avaiable record and locks the record. If
employee #2 clicks the button are they going to get the same record as
employee #1 if they have not saved their record?

Private Sub Go_To_First_Record_Click()
On Error GoTo Err_Go_To_First_Record_Click
DoCmd.GoToRecord , , acFirst
Exit_Go_To_First_Record_Click:
Exit Sub
Err_Go_To_First_Record_Click:
MsgBox Err.Description
Resume Exit_Go_To_First_Record_Click
End Sub
Private Sub Open_Form_Click()
On Error GoTo Err_Open_Form_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Registration Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms("Reg query open").RecordLocks = 2
Exit_Open_Form_Click:
Exit Sub
Err_Open_Form_Click:
MsgBox Err.Description
Resume Exit_Open_Form_Click
End Sub

Second issue is there a way to set the date and time in a field as the
record is opened?

Each station has to log start and end time. It would be nice if the
start time would autofill on open and end time autofill on close. The
less the users have to do the better.

Any ideas Thank you.
 
Top