Compile Error: User defined type not defined

aaromic2000

New Member
Joined
Jul 28, 2009
Messages
32
Hi I'm actually trying to capture the system logout time in a field in access. The below formula is I'm using and I'm getting the Compile error. I'm using Access 2010 and exactly which reference object should I chose from tools

Code:
Private Sub Logout_Click()


End_Time.Value = Now()


If MsgBox("No Changes will be allowed further! Are you sure you want to Logout?", vbYesNo) = vbYes Then


Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As Long
                Set cn = New ADODB.Connection
                cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Reports.mdb"
                Set rs = New ADODB.Recordset
                rs.Open "Attendance", cn, adOpenKeyset, adLockOptimistic, adCmdTable
        
                r = 3
            
                With rs


                 .AddNew


                    If LTrim(RTrim(End_Time.Text)) <> "" Then
                        .Fields("End Time") = End_Time.Text
                    End If
                    
            
                 .Update


                End With


                r = r + 1


                rs.Close
                                
        Set rs = Nothing
        cn.Close
        Set cn = Nothing
        
        Else
        
        If vbNo Then
        
        End If


End Sub
 
Last edited by a moderator:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try Microsoft ActiveX Data Object 2.8 Library.
 
Upvote 0

Forum statistics

Threads
1,215,222
Messages
6,123,706
Members
449,118
Latest member
MichealRed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top