Class error 430 (1 Viewer)

SjCc

Registered User.
Local time
Today, 05:52
Joined
Oct 5, 2017
Messages
67
hi using this on a form on load event it poping error class does not support ... interface.. else on another pc with same os is running fine with no error.. the code is below


Code:
Option Compare Database

Public Function LogIN()
Dim TempID As String
Dim TempID2 As Long
TempID = UserOnName
TempID2 = UserOnID
Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command

Set rs = New ADODB.Recordset
Set cmd = New ADODB.Command

cmd.ActiveConnection = CurrentProject.Connection

cmd.CommandText = "Select UserName, AccessLevel, deactive " _
                & "From tblEmployees " _
                & "Where UserName = '" & TempID & "'"
                
cmd.Execute
    rs.Open cmd, , adOpenKeyset, adLockOptimistic
    If rs.EOF = True Then GoTo KL
    'rs.MoveFirst
    'Do Until rs.EOF = True
       ' If rs.Fields(0) = TempID Then
        If rs.Fields(2) = -1 Then
            MsgBox "This Employee has been deactiveated from this utility, please contact the administrator", vbCritical
            DoCmd.Quit
        Else 'End If
            DoCmd.OpenForm "frmreports"
            rs.Close
            GoTo vt
        End If
      '  rs.MoveNext
   ' Loop
KL:
        rs.Close
        MsgBox "Authorized Personal Only, please contact a system administrator to use this utility.", vbCritical
        cmd.CommandText = "SELECT * FROM tblLogReport "
        cmd.Execute
        rs.Open cmd, , adOpenKeyset, adLockOptimistic
        rs.AddNew
        rs.Fields(0) = TempID 'fOSUserName
        rs.Fields(1) = Date
        rs.Fields(2) = Time
        rs.Fields(3) = "Attempted LogIN, Invalid User"
        rs.Fields(4) = TempID2
        rs.Update
        rs.Close
        DoCmd.Quit
        
        
vt:
cmd.CommandText = "SELECT * FROM tblLogReport "
cmd.Execute
    rs.Open cmd, , adOpenKeyset, adLockOptimistic
    rs.AddNew
    rs.Fields(0) = TempID 'fOSUserName
    rs.Fields(1) = Date
    rs.Fields(2) = Time
    rs.Fields(3) = "LogIN"
    rs.Fields(4) = TempID2
    rs.Update
    rs.Close
    
cmd.CommandText = "Select * FROM tblStartTime " _
                & "WHERE EmpLogin = '" & TempID & "' AND StartDate = #" & Date & "#"
cmd.Execute
rs.Open cmd, , adOpenKeyset, adLockOptimistic
    If rs.EOF = True Then
        rs.AddNew
        rs.Fields(0) = TempID
        rs.Fields(1) = Date
        rs.Fields(2) = Time
        
        rs.Update
        rs.Close
    End If
Set rs = Nothing
Set cmd = Nothing

End Function
 
Last edited by a moderator:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:52
Joined
Jul 9, 2003
Messages
16,244
The first thing to check, have you got a reference to ADO in the references?

Sent from my SM-G925F using Tapatalk
 

SjCc

Registered User.
Local time
Today, 05:52
Joined
Oct 5, 2017
Messages
67
The first thing to check, have you got a reference to ADO in the references?

Sent from my SM-G925F using Tapatalk

Thanks for reply indeed!! this is what attached file saying that i have added these.. please see
 

Attachments

  • Untitled.png
    Untitled.png
    93.3 KB · Views: 105

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:52
Joined
Aug 30, 2003
Messages
36,118
What line throws the error?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:52
Joined
Jul 9, 2003
Messages
16,244
Also add:-

Option Compare Database
Option Explicit

Thus
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:52
Joined
Aug 30, 2003
Messages
36,118
Curiouser and curiouser. ;)
 

Users who are viewing this thread

Top Bottom