Help Needed Adding Password to Add Record Command Button

  • Thread starter Thread starter TK
  • Start date Start date
T

TK

I have a form with an "Add Record" and "Delete Record" button on it. I have
attached the following code to the "Add Record" button, and if your enter
ther wrong password you get the Message Box correctly. BUT if you enter the
corred password it does not add a new record. Can someone tell me what I ad
doing wrong?

Many thanks,

TK


Private Sub Command55_Click()

If InputBox("Enter Password") = "xyz" Then
DoCmd.GoToRecord , , acNewRec
Else
' the entered password was incorrect
MsgBox "Sorry, the password you have " & "entered is incorrect."

End If

End Sub
 
Do you mean, it does not blank the screen (or move to a blank row of fields)
ready for entry of a new record? Or do you mean that it does not immediately
add a blank record to the actual database table?

It should do the former - not the latter.

HTH,
TC
 
Thank for the reply. What happens is if I enter the wrong password, I do
get the error message. But if I enter the correct password it does
absolutely nothing. The screen does not change, it does not blank the
screen ready for a new entry, just nothing.

Again, any help would be most appreciated.

Thanks,
TK
 
Here are some things you could try.

1. Check that the DoCmd.GoToRecord has the parameter in the right place. (I
don't have Access here to check it myself.)

2. See if you can add a record using the form's navigation buttons (if it
has any) or the menu option (Insert : Record?). If you can't, then the cause
is something else - not your code.

3. If 1. & 2. are both ok, I'd get desperate & add a msgbox immediately
before your DoCmd.GoToRecord, just to be sure that you are actually looking
at the right code!

HTH,
TC
 
Back
Top