Ok. This is a little complex so I hope that I explain myself correctly.
I use a customized log in system that I found on these forums. Iw works flawlessy.
When a the database is opened frm_Logon opens.
In the on open event of that form frm_LogonStorage is opened. This is a hidden form.
On frm_Logon there is a combo box control called cboEmployee that gets it's data from a tacle called tbl_User
On this control's afterupdate event I have the following code
The purpose of storing this data in a hidden form is to control who can edit records on another from called pfrm_EditContactNotes
The onopen event of this for has the following code
Now here is the therory bedhind this. When pfrm_EditContactNote opens it checks to see if the logged on user (UserID in frm_LogonStorage) is the user that created the record (ChangeId on pfrm_EditContactNote)
If I allow the vba to fill in the fields in frmLogonStorage, when pfrm_EditContactNote opens it always use the else part of the If statement. However if I manualy type the UserID in frm_LogonStorage the form pfrm_EditContactNote opens correctly depending who is logged on.
I am feeling this has someting to do with the number format but have tried making sure they are the same format to no avail.
Any assistance with this would be greatly appreciated.
I use a customized log in system that I found on these forums. Iw works flawlessy.
When a the database is opened frm_Logon opens.
In the on open event of that form frm_LogonStorage is opened. This is a hidden form.
On frm_Logon there is a combo box control called cboEmployee that gets it's data from a tacle called tbl_User
On this control's afterupdate event I have the following code
Code:
Private Sub cboEmployee_AfterUpdate()
'After selecting user name set the values in the hidden form frm_LogonStorage
Forms!frm_LogonStorage!UserName = Forms!frm_Logon!cboEmployee.Column(1)
Forms!frm_LogonStorage!UserID = Forms!frm_Logon!cboEmployee.Column(0)
Forms!frm_LogonStorage!SecurityLevel = Forms!frm_Logon!cboEmployee.Column(2)
Forms!frm_LogonStorage!UserFirstName = Forms!frm_Logon!cboEmployee.Column(3)
Forms!frm_LogonStorage!UserLastName = Forms!frm_Logon!cboEmployee.Column(4)
'After selecting user name set focus to password field
Me.txtPassword.SetFocus
End Sub
The purpose of storing this data in a hidden form is to control who can edit records on another from called pfrm_EditContactNotes
The onopen event of this for has the following code
Code:
If Forms!frm_LogonStorage!UserID = Me.ChangeID Then
Me.cmdSave.Visible = True
Me.cmdDelete.Visible = True
Me.Subject.Locked = False
Me.ContactNote.Locked = False
Me.cmdCancel.Caption = "Cancel Change"
Else
Me.cmdSave.Visible = False
Me.cmdDelete.Visible = False
Me.Subject.Locked = True
Me.ContactNote.Locked = True
Me.cmdCancel.Caption = "Close Form"
MsgBox "You did not create this contact note, therefore you do not have permission to change it or delete it. However you can view it and copy it's contents.", vbApplicationModal + vbExclamation, "Security Warning"
End If
End Sub
Now here is the therory bedhind this. When pfrm_EditContactNote opens it checks to see if the logged on user (UserID in frm_LogonStorage) is the user that created the record (ChangeId on pfrm_EditContactNote)
If I allow the vba to fill in the fields in frmLogonStorage, when pfrm_EditContactNote opens it always use the else part of the If statement. However if I manualy type the UserID in frm_LogonStorage the form pfrm_EditContactNote opens correctly depending who is logged on.
I am feeling this has someting to do with the number format but have tried making sure they are the same format to no avail.
Any assistance with this would be greatly appreciated.