I am working on updating some features and code for my database. I have different access levels to my database. This system was intended to collect requests from users for testing to be conducted. A supervisor form to handle the requests was set up. I set up that form and forms that could allow multiple users to access the same record to only allow one user to access the record at a time. At any time I could have conflicts as often as 2 or 3 times a week. Which if trying to maintain any semblance of integrity isn't good. That being said, my problem is on the supervisor form. What I am doing is allowing the supervisor to delete information from the record. Now they can only delete to fields worth of information. So I set up an update query to null the fields out. The problem I have is that when the record is selected it isn't possible to update the fields to null because the record is locked out. I found this out by running the query while having the particular record selected. So I played around some and found out if I change the status of the Data Entry for the form, I can manipulate the record as I had wanted to. The problem I am running into is that when I turn the Data Entry from false to true, other fields have their value changed as well. One is a combo box, the other a check box and even a date field. Now none of the changes that happen on the form are saved to the record, however it just looks all messed up. I certainly have methods for which I can make things look proper again, I just am looking to see if there is a better way or what may be causing the toggling of the Data Entry to false has on the form itself. Any advice is appreciate. Here is my code also if anyone wants to have a look.
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim CHID As String
Dim FLName As String
Dim TRN As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("UserInformationQuery")
CHID = rs!ID
FLName = rs!FullName
rs.Close
If Me.IsSampleHere = True Then
Exit Sub
DoCmd.OpenForm "SampleEntryForm"
DoCmd.GoToRecord , , acNewRec
Forms!SampleEntryForm!TRNumberCombo = Me.TRNumberCombo.Column(0)
Forms!SampleEntryForm!SampleInputDate = Format(Now, "MM/DD/YYYY")
Forms!SampleEntryForm!TechnicianApproval = CHID
Forms!SampleEntryForm!TechnicianFullName = FLName
Else
If MsgBox("A sample has alread been logged into the system." & _
vbNewLine & _
"Are you intentionally marking the sample as not " & _
vbNewLine & _
"being here?", vbQuestion + vbYesNo, "Sample Not Here?") = vbNo Then
Me.IsSampleHere = True
Else
If MsgBox("Do you want to remove the sample entry from the database?", vbQuestion + vbYesNo) = vbYes Then
Me.DataEntry = True
DoCmd.SetWarnings False
DoCmd.OpenQuery "DeleteSampleEntryQuery"
DoCmd.OpenQuery "UpdateSampleDeletedLocationQuery"
DoCmd.SetWarnings True
Me.DataEntry = False
Set TRN = Me.RecordsetClone
TRN.FindFirst "[TRNumber] = """ & Me.TRNumberCombo.Column(1) & """"
If TRN.NoMatch Then
MsgBox "There was a problem with the record you selected."
Else
Me.Bookmark = TRN.Bookmark
End If
Set TRN = Nothing
Else
MsgBox "Please contact a local admin for assistance.", vbInformation
Exit Sub
End If
End If
End If