2 Replies - 591 Views - Last Post: 22 September 2013 - 06:49 AM Rate Topic: -----

#1 brerallia  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 146
  • Joined: 21-January 13

What to add in reference for module?

Posted 21 September 2013 - 09:26 PM

so i have this login form with this code

Dim llogin As New ADODB.Recordset

Private Sub Command1_Click()
If llogin.State = adStateOpen Then
llogin.Close
End If

where u.Username='" & txt_username.Text & "'", c
llogin.Open "select * from Users where UserName ='" & txt_usernmae & "'", c
If llogin.RecordCount > 0 Then
    If llogin("Password") = txt_password Then
        c_user = llogin("FirstName")
        MsgBox "You have successfully logged in"
    Else
        MsgBox "Incorrect Password"
    End If
Else
    MsgBox "User does not exist"
End If

End Sub

Private Sub Form_Load()
Module1.Connect
llogin.CursorLocation = adUseClient
llogin.CursorType = adOpenStatic
llogin.LockType = adLockOptimistic

txt_username = ""
txt_password = ""
End Sub



and a module to connect to database

Dim c As New ADODB.Connection
Dim current_user As String
Dim match As Boolean


Public Sub Connect()
c.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\StockInformationInquirySystem.mdb"
c.Open
End Sub

Public Sub Disconnect()
c.Close
Set c = Nothing
End Sub


i got this error everytime i click the login button
RUNTIME ERROR 3001: ARGUMENTS ARE NOT VALID......

and it pointed the llogin.open ... line as the error to debug....
i tried to find out how to debug it and it seems that the module is the culprit...

I tried to remove the current module and replace it with another one that the code is the same.... very the same.. and when i run it and click the login button it doesnt get an error.... but when i shift the other module.... it runs an error...

is there any reference i forgot??? the code is the same..

ANY HELP WILL BE APPRECIATED.

Is This A Good Question/Topic? 0
  • +

Replies To: What to add in reference for module?

#2 jimzcoder  Icon User is offline

  • D.I.C Regular

Reputation: 54
  • View blog
  • Posts: 331
  • Joined: 14-November 12

Re: What to add in reference for module?

Posted 22 September 2013 - 05:38 AM

honestly. i don't really get what your line #8 code is for.
have you tried removing that line and see what happens then?
Was This Post Helpful? 1
  • +
  • -

#3 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3221
  • View blog
  • Posts: 10,804
  • Joined: 12-December 12

Re: What to add in reference for module?

Posted 22 September 2013 - 06:49 AM

You have misspelt txt_usernmae. Adding Option Explicit to the top of every module will help you track down these errors.

This will also tell you if the variable c is in scope - available in the Click event.

This post has been edited by andrewsw: 22 September 2013 - 06:55 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1