How to avoid 2585 Error

M

Manuel

This seems like it would be easy to do but I can't figure it out...

I have a login form where the user selects his/her User ID and enters a
password. The user then selects a command button to sign in. The command
button runs through some code which checks the password and then closes the
Sign In form and opens another form if the password is correct. What I want
to do is have the command button code run when the user hits the ENTER key on
his/her keyboard (this would provide the user with two options for logging
into the database: select the Sign In command button, or simply press ENTER
on the keyboard).

The problem is that I can't seem to accomplish this seemingly easy task
without triggering the 2585 run-time error. What I've done is called the
code from the ENTER event of the next tab control. Apparently Access doesn't
like the fact that I'm trying to close a form on the "ENTER" event of this
control.

Any suggestions for how to circumvent this error? Is there a better way to
do this?

Thanks,
Manuel
 
D

Dirk Goldgar

Manuel said:
This seems like it would be easy to do but I can't figure it out...

I have a login form where the user selects his/her User ID and enters a
password. The user then selects a command button to sign in. The command
button runs through some code which checks the password and then closes
the
Sign In form and opens another form if the password is correct. What I
want
to do is have the command button code run when the user hits the ENTER key
on
his/her keyboard (this would provide the user with two options for logging
into the database: select the Sign In command button, or simply press
ENTER
on the keyboard).

The problem is that I can't seem to accomplish this seemingly easy task
without triggering the 2585 run-time error. What I've done is called the
code from the ENTER event of the next tab control. Apparently Access
doesn't
like the fact that I'm trying to close a form on the "ENTER" event of this
control.

Any suggestions for how to circumvent this error? Is there a better way
to
do this?

Have you tried just setting the command button's "Default" property (on the
Other tab of the control's property sheet), to make it the form's Default
button? If you do that, then any time the user presses Enter on the form,
the button's Click event should fire.
 

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