Thanks Tina for responding so quickly... I have tried this, and I keep
getting an error that says "You have canceled the previous operation".
Here is my code:
----------start-------------------------
Private Sub open_main_menu_form_Click()
On Error GoTo Err_open_main_menu_form_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stUserName As String
Dim inGroupId As Variant
stUserName = Me![user-name-box]
inGroupId = DLookup("[sysu-user-group]", "sys-users", "[sysu-user-name]
= " & stUserName)
If inGroupId = 1 Then
DoCmd.Close
stDocName = "main-menu-all"
DoCmd.OpenForm stDocName, , , stLinkCriteria
ElseIf inGroupId = 2 Then
DoCmd.Close
stDocName = "main-menu-user"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
DoCmd.Close
stDocName = "password-fail-error"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_open_main_menu_form_Click:
Exit Sub
Err_open_main_menu_form_Click:
MsgBox Err.Description
Resume Exit_open_main_menu_form_Click
End Sub
--------------end------------------
tina said:
Dim var As Variant
var = DLookUp("value", "table")
If var = Me!ControlName Then
' do something
Else
' do something else
End If
hth
<Navatin> wrote in message
I have a procedure I am trying to write withing a "On Click" from a form
button. In this, I would like to select a value from a record in a
table,
compare that value to a value that a user entered, then have a IF/THEN
based
on the comparison.
Any suggestions?