• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

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
0
strongd
Asked:
strongd
  • 2
  • 2
1 Solution
 
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
 
PePiCommented:
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
 
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now