Hi... I am a little confused and hoped that someone here might be able to help me?
I am creating am Access 2010 database to record case notes for patients. Only one user can read the patients details or add case notes to the patients record at any one time. I have created an extra field called LockedBy which will record the user who currently is viewing details or adding case notes for that patient on opening the form. It seem update the LockedBy field for the patients record on the form_load but the form_close sub will not allow me to set the LcokedBy field at all. The error is "You can't assign a value to this object".
The form has the following values set:
Data Entry = No
Allow Additions = No
Allow Deletions = No
Allow Edits = Yes
Allow Filters = Yes
Record Locks = No Lock
Thanks in advance
Tanya
I am creating am Access 2010 database to record case notes for patients. Only one user can read the patients details or add case notes to the patients record at any one time. I have created an extra field called LockedBy which will record the user who currently is viewing details or adding case notes for that patient on opening the form. It seem update the LockedBy field for the patients record on the form_load but the form_close sub will not allow me to set the LcokedBy field at all. The error is "You can't assign a value to this object".
The form has the following values set:
Data Entry = No
Allow Additions = No
Allow Deletions = No
Allow Edits = Yes
Allow Filters = Yes
Record Locks = No Lock
Code:
Private Sub Form_Close()
'Set the LockedBy field for Patient's record to be unlocked
Me.LockedBy = ""
'Me.Update
'Open the All Patients form
DoCmd.OpenForm "AllPatientsForm", acNormal
End Sub
Private Sub Form_Load()
If (LockedBy = GetCurrentUserName()) Or (IsNull(LockedBy)) Then
Me.LockedBy = GetCurrentUserName()
'Me.Update
SetFormTitles
'Close the All Patients form
DoCmd.Close acForm, "AllPatientsForm", acSaveNo
Else
MsgBox "Patient is locked by " + LockedBy, vbExclamation, "Patient Locked"
End If
End Sub
Tanya
Last edited: