Restarting an app. back to start...

Hello, I created an application that is basically a GUI(Front-end) to a SQL Server DB.  When the user double clicks the app to start, it pops up a login form.  If the user puts in the right password it continues and connects to the DB and populates the datagrid.  That is perfect, but when a user puts in the wrong username or password, I have an adodc_error routine that traps the error that was given by the ado object, but the gui still pops up but the datagrid and it isn't populated.  

When it errors out on a bad password or username, I want it to call the login form again, hide the main GUI (Where datagrid is) and start from the beginning again. Can someone give me some sample code helping me with this.

I have 2 forms.  1 form is the login form, the other is the GUI form.

I am using VB version 6.

Thanks
strongdAsked:
Who is Participating?
 
PePiConnect With a Mentor Commented:
why not move your code from from2 to form1. i mean, make the connection in form1 (which i assume is your login form). validate the username & password in form1. if correct username & password was provided, load form2 if not stay with form1 and allow another try to enter username & password.

create a module and declare your connection variables there. this will ensure that both your forms will have access to the connection.

good luck!
0
 
PePiCommented:
if an error occurs or a bad username or password was provided, don't load form 2. it would help if you can post your code.
0
 
strongdAuthor Commented:
My code is in form2, it pass's the user name and password to the adodc which is in form2.

0
 
strongdAuthor Commented:
I can't believe I didn't think  of creating another module ...  I was trying to do everything in the forms...  Thanks...

I feel dumb now..

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.