Hi,
I've got some code that's giving me problems. I'm allowing priviledged users the ability to modify some table content via datasheet forms. The tables are used as combo box data sources throughout the database.
I've given them a combo box (cboLists) to select the pick list (table) that they would like to modify the contents of, and a command button to open the selected pick list modification form. cboLists is based on a table with two fields: Form and Description (both text fields). cboLists shows the user the description, but not the form name to be opened.
What I'd like to do is prompt the user with a simple messagebox if they open a certain form. I'm getting a type mismatch error with this code:
Any ideas why I'm getting this error?
I've got some code that's giving me problems. I'm allowing priviledged users the ability to modify some table content via datasheet forms. The tables are used as combo box data sources throughout the database.
I've given them a combo box (cboLists) to select the pick list (table) that they would like to modify the contents of, and a command button to open the selected pick list modification form. cboLists is based on a table with two fields: Form and Description (both text fields). cboLists shows the user the description, but not the form name to be opened.
What I'd like to do is prompt the user with a simple messagebox if they open a certain form. I'm getting a type mismatch error with this code:
Code:
Private Sub cmdModifyList_Click()
On Error GoTo Err_cmdModifyList_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = Me.cboLists
If Me.cboLists = "frmListAgencies" Or "frmListChemicals" Then
MsgBox "This list should only be modified by EHS personnel.", vbExclamation + vbOKOnly
ElseIf Me.cboLists = "frmListEmployees" Then
MsgBox "This list should only be modified by Human Resources personnel.", vbExclamation + vbOKOnly
Else
'Do nothing
End If
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria, , acDialog
Me.cboLists = ""
Exit_cmdModifyList_Click:
Exit Sub
Err_cmdModifyList_Click:
MsgBox Err.Description
Resume Exit_cmdModifyList_Click
End Sub
Any ideas why I'm getting this error?