Hi,
I'm fairly new to VBA programming although not new to programming in general.
I think my problem is with my syntax but would appriate any help.
I am trying to get it so that when the user enters the correct password it will change the RecordSource of the Arts form to use ArtsQuery2 and then open.
Thanks,
I'm fairly new to VBA programming although not new to programming in general.
I think my problem is with my syntax but would appriate any help.
Code:
Private Sub Command7_Click()
Dim strInput As String
Dim strMsg As String
Dim stDocName As String
Dim stLinkCriteria As String
strMsg = "Please enter password to proceed."
strInput = InputBox(Prompt:=strMsg, title:="Password Prompt")
If strInput = "gotit" Then 'password is correct
stDocName = "Arts"
Forms_Arts.RecordSource = ArtsQuery2
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else 'password is incorrect
MsgBox "Incorrect Password!", vbCritical, "Password Error"
Exit Sub
End If
End Sub
I am trying to get it so that when the user enters the correct password it will change the RecordSource of the Arts form to use ArtsQuery2 and then open.
Thanks,