?
Solved

Restarting an app. back to start...

Posted on 2004-08-18
4
Medium Priority
?
186 Views
Last Modified: 2010-05-02
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
Comment
Question by:strongd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:PePi
ID: 11832167
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
 

Author Comment

by:strongd
ID: 11832623
My code is in form2, it pass's the user name and password to the adodc which is in form2.

0
 
LVL 6

Accepted Solution

by:
PePi earned 200 total points
ID: 11832821
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
 

Author Comment

by:strongd
ID: 11833029
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question