Error opening form, some reason it goes to vba code?

swarv

Registered User.
Local time
Today, 16:26
Joined
Dec 2, 2008
Messages
196
Hi all,

I have a username/password form and when the user clicks ok the program goes through some checks and then is meant to load another form.

But when the user clicks on the program brings up the vba code window and highlights a line in yellow. When I press F5 the program continues and carrys on as normal and loads the form.

when I next load the form it goes in stragiht away.

The line it stops on is:

Code:
    Case 0, 1

There isn't a break point here (i.e. not in red).

Any ideas anybody?

Thanks
 
Hi -

We probably need to see the entire VBA for the OnClick event.

Bob
 
hi,

I have pasted the module that it goes to into the attached txt doc.

Thanks

Hope you can help
 

Attachments

Have you tried

Case < 2

Also go to VBA in the form and select Debug > Clear all breakpoints then save the form and retry.
 
I just tried doing clear all break points and no luck.

but the < 2 seems to work.

just our of interest do you know why doing it the other way didn't work?

Many many many thanks
 
I am honoured that you are using my code that I posted on another forum.

Are you using Access 2007, the code was written for Access 2003?

If using A2003, do the following

After Clearing all the breakpoints etc. Do a Compile in the Debug Menu of the code and check for any errors that maybe displayed.

Before the Select Case valid_user put the following code
Msgbox valid_user this will display the value of the vaild_user flag before the Case statement does it job.

What is the value of valid_user?

Would you please post a database with your tables and forms and code that you use to login?
 
Usually when using case statements you start with the lowest or the most predictable value first.

When grouping conditions within one case then it usually reads

Case Is 1 , 2

but Case 0, 1 is still syntactically correct. Maybe Access is being pendantic today.

Remember also always have a case else statement this will act as a catch all other options point. This can be used for error trapping etc.

David
 
hi, cheers for the code then, it is excellent. and whats better is the fact that I can nearly understand it.

I did do the clear breakpoints and debug but to no avail.

I have since changed that line to < 2 and it seems to work.
No idea why tho - would you have any idea?

Cheers

Martin
 
cheers DCrake, I'll add that in as well. every little helps... (as a well known supermarket says).
 

Users who are viewing this thread

Back
Top Bottom