Hello All,
Im passing a value "UserID" from a switchboard form to another form ("Discharges") using this code:
Code:
Private Sub cmdDischarges_Click()
Dim UserID As Integer
UserID = Me.txUserID
DoCmd.OpenForm "Discharges"
Forms![Discharges]!txUserID = UserID
End Sub
On "Discharges" I have set up an lock/edit control that works well. I am attempting to only allow a record to be edited by the person assigned to that record (the "Reviewer"), but still allow all records to be readable. My hope is to accomplish this by disabling the lock/edit control for all unassiged Reviewers. This is the code that Im using currently to disable the lock/edit control:
Code:
Private Sub Form_Current()
If Me.NewRecord Then
Else
If Me.txUserID <> Me.txReviewer Or IsNull(Me.txReviewer) Then
Me.cmdEdit.Enabled = False
End If
End If
End Sub
The UserID value passes from the Switchboard form to the Discharges form, but editing for all records is disabled. However, if I manually enter a UserID into Me.txUserID on the Discharges form, the code works perfectly. Any suggestions on how to get this to work properly? Seems like it should be simple stuff, but Im a VBA novice.
Thank you in advance for your help!