W
WANNABE
I am trying to test a condition of a table value on form open, and the value
I need to test is the USERNAME. I used Environ(username) on the fields
Default property to set the value. But I'm not smart enough to figure out
all the intricate differences between what is needed in VBA and what is
needed in forms, YET!! Now the following is the code that I have started
with and there are 2 errors.
Private Sub Form_Open(Cancel As Integer)
Dim stDocName, stLinkCriteria, stUserId As String
Dim Test As Boolean
' stUserId = Environ(UserName)
' This is for testing because the previous line caused errors
stUserId = "myname"
' This line is now erroring out, something about cancelled previous
operation.
DLookup("UserID", "Emp", "UserID= stUserID ") = Test
If Test Then
stDocName = "frm_UserEntry"
Me.Visible = False
DoCmd.OpenForm stDocName, , acEdit, stLinkCriteria
Else
'do that
End If
End Sub
Any Help would be greatly appreciated! thank you!
I need to test is the USERNAME. I used Environ(username) on the fields
Default property to set the value. But I'm not smart enough to figure out
all the intricate differences between what is needed in VBA and what is
needed in forms, YET!! Now the following is the code that I have started
with and there are 2 errors.
Private Sub Form_Open(Cancel As Integer)
Dim stDocName, stLinkCriteria, stUserId As String
Dim Test As Boolean
' stUserId = Environ(UserName)
' This is for testing because the previous line caused errors
stUserId = "myname"
' This line is now erroring out, something about cancelled previous
operation.
DLookup("UserID", "Emp", "UserID= stUserID ") = Test
If Test Then
stDocName = "frm_UserEntry"
Me.Visible = False
DoCmd.OpenForm stDocName, , acEdit, stLinkCriteria
Else
'do that
End If
End Sub
Any Help would be greatly appreciated! thank you!