Locked myself out of DB

M

Mike P

I have a form "frmCopyRight" that is the display form when the database
opens. Inside the form load, I put a if statement with a quit the program
based on the criteria. The criteria seems to be always true and I've locked
myself out of the program! Any ideas how to get back into my code to remove
this?

The database has a password. I enter that correctly, then the MsgBox pops
up with the termination notice I wrote i my if. Here is the code.

Private Sub Form_Load()

If Date > "07/01/2009" Then
MsgBox "Major Error x077: Notify Mike " & Date, vbCritical,
"Termination Required"

DoCmd.Quit
End If

End Sub

I think I may have typed something odd in the If, cause I have tried
switching the data on my computer before I open the program using dates
greater than 7/1/09 and less than 7/1/09.

I am totally stuck!
 
J

Jack Leach

Open the db using the shift bypass.

Hold the shift key down while double clicking the mdb (the actual file, not
a shortcut). This should bypass any startup functions and let you at the
code.

Or, if your messagebox is popping up, try Ctl+Break to break the running
code and debug. From there you can try to work your way out of the active
procedure into a state you can edit it.

If you've taken steps to disable these two features so you're user can't get
in, it's going to take a bit more work.

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
J

John W. Vinson

I have a form "frmCopyRight" that is the display form when the database
opens. Inside the form load, I put a if statement with a quit the program
based on the criteria. The criteria seems to be always true and I've locked
myself out of the program! Any ideas how to get back into my code to remove
this?

The database has a password. I enter that correctly, then the MsgBox pops
up with the termination notice I wrote i my if. Here is the code.

Private Sub Form_Load()

If Date > "07/01/2009" Then
MsgBox "Major Error x077: Notify Mike " & Date, vbCritical,
"Termination Required"

DoCmd.Quit
End If

End Sub

I think I may have typed something odd in the If, cause I have tried
switching the data on my computer before I open the program using dates
greater than 7/1/09 and less than 7/1/09.

Hold down the SHIFT key after you have entered your password and before
pressing Enter to open the database. This will bypass your code.

The problem is that Dates are *not* strings. Your if may work better using the
# date delimiters:

If Date > #7/1/2009# Then

although it is not clear to me how today's date being after July 1 is a
critical error!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top