culpees
asked on
VBA RunTime Error 2494
I have a password prompt form with an "okay" button.
When that Okay button is clicked, the action needs to check the password attempt vs the actual password, close the prompt form, open the next form and go to a control.
This is my code. It is on the 'On click' event of the button.............
Private Sub cmdAdd_Click()
Dim stDocName As String
stDocName = "USER_ADD"
If Me.PasswordAttempt.Value = Me.PASSWORD Then
DoCmd.Close acForm, "SECURITY", acSaveNo
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acWindowNormal
Forms!USER_ADD!NAME_SHORT. SetFocus
Else
DoCmd.CancelEvent
Forms!SECURITY!Message = "Password Incorrect"
End If
End Sub
I'm still learning vba and consider myself an amateur. Please tell me why this hates me so.
When that Okay button is clicked, the action needs to check the password attempt vs the actual password, close the prompt form, open the next form and go to a control.
This is my code. It is on the 'On click' event of the button.............
Private Sub cmdAdd_Click()
Dim stDocName As String
stDocName = "USER_ADD"
If Me.PasswordAttempt.Value = Me.PASSWORD Then
DoCmd.Close acForm, "SECURITY", acSaveNo
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acWindowNormal
Forms!USER_ADD!NAME_SHORT.
Else
DoCmd.CancelEvent
Forms!SECURITY!Message = "Password Incorrect"
End If
End Sub
I'm still learning vba and consider myself an amateur. Please tell me why this hates me so.
ASKER
well, hey there.
The code is on the first form which is the password prompt form called "SECURITY".
The code is on the "Okay" button, 'on click' event, which would then open up the next form that requires restricted access.
This next form is called "USER_ADD". (it's a simple data entry form to add user access to the application.)
The code is on the first form which is the password prompt form called "SECURITY".
The code is on the "Okay" button, 'on click' event, which would then open up the next form that requires restricted access.
This next form is called "USER_ADD". (it's a simple data entry form to add user access to the application.)
can you upload ... code 'looks' ok ... ie syntax for DoCmd.OpenForm ...
mx
mx
fyi ... I have to leave work soon ...will be back online a bit later ..
mx
mx
ASKER
IDK. I made a fake mdb for you and tested it and it worked. I pulled in the applicable forms & tables. But I can't get it to work in my real one. I get several different errors at different places with my real one. I don't know what's going on.
I tried decompiling a copy of it and it messed it up. So I'm back to my original.
I've got to go get my kids now, so I'll try to attach something that is showing errors or even print screens later.
I tried decompiling a copy of it and it messed it up. So I'm back to my original.
I've got to go get my kids now, so I'll try to attach something that is showing errors or even print screens later.
ok Mom :-)
mx
mx
ASKER
Had to put this aside for a bit. Business trip plus some.
Will come back to this and provide all the info you need in order to get this resolved. Sorry I can't do it now. I would LOVE to get this problem resolved!! Will be about a week before I can return to this.
Will come back to this and provide all the info you need in order to get this resolved. Sorry I can't do it now. I would LOVE to get this problem resolved!! Will be about a week before I can return to this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Okay. I'm back.
I created a dummy mdb of the precise objects in the database which were tied to the problem code to share here. When I tried recreating the error in the dummy db prior to sharing it, there was none. It worked perfectly.
So I recreated the whole bleepin' database by importing all objects into a blank one and whoolah! All the code compiled fine. The old db had been corrupt, I guess.
All that time chasing geese. So I'm off to create a new thread on a new problem. Yippee!
I created a dummy mdb of the precise objects in the database which were tied to the problem code to share here. When I tried recreating the error in the dummy db prior to sharing it, there was none. It worked perfectly.
So I recreated the whole bleepin' database by importing all objects into a blank one and whoolah! All the code compiled fine. The old db had been corrupt, I guess.
All that time chasing geese. So I'm off to create a new thread on a new problem. Yippee!
mx