473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

log out problem. help !

this is my login form.
i got other form log out button that go to this log in form to login again
when i login again it will pop up this error:
operation is not allowed when the object is open
Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim intFounds As String
  3. strCNString = "Data Source=" & App.Path & "\PayrollBakeryDB.mdb"
  4. cn.Provider = "Microsoft Jet 4.0 OLE DB Provider"
  5. cn.ConnectionString = strCNString
  6. cn.Open
  7. intFounds = 2
  8.     With rs
  9.         .Open "SELECT s_username,s_password,m_username,m_password,b_username,b_password FROM Employees", cn, adOpenDynamic, adLockOptimistic
  10.          Do Until .EOF
  11.             If txtname.Text = !b_username And txtpass.Text = !b_password Then
  12.                 intFounds = 1
  13.                 P_BossMenu.Show
  14.                 Exit Sub
  15.             ElseIf txtname.Text = !m_username And txtpass.Text = !m_password Then
  16.                 intFounds = 1
  17.                 P_ManagerMenu.Show
  18.                 Exit Sub
  19.             ElseIf txtname.Text = !s_username And txtpass.Text = !s_password Then
  20.                 intFounds = 1
  21.                 P_StaffMenu.Show
  22.                 Exit Sub
  23.  
  24.             End If
  25.             .MoveNext
  26.           Loop
  27.           .MoveFirst
  28.           If intFounds = 2 Then
  29.                    MsgBox "Wrong username or password", vbExclamation, "Search"
  30.           End If
  31.  
  32.      End With
  33.  
  34. cn.Close
  35.  
  36.  
Apr 10 '07 #1
1 907
Killer42
8,435 Expert 8TB
At what line of code does the error occur? And what version of VB is this?

Hm... on further consideration, I'd hazard a guess that you haven't closed the recordset (or connection, or something), so VB isn't happy about you trying to open it again.

Note that if this pasted code is accurate, executing one of the Exit Sub statements will bypass the Close down the bottom, and leave things open. (This may or may not be what you intended.)
Apr 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.