I have been at this for a little while now... anyone have any ideas? Here is the code...
Option Compare Database
Private Sub Report_Open(Cancel As Integer)
Dim db As Database
Dim rs As Recordset
Dim Date1 As Date
Dim Date2 As Date
Dim CompanyID As Long
Dim dt As Date
CompanyID = [Forms]![Main Menu]![Customer ID]
dt = Date
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT TOP 2 InspectionTable.InspectionID, InspectionTable.CompanyID, InspectionTable.DateOf FROM InspectionTable WHERE (((InspectionTable.CompanyID)= " & CompanyID & "
AND ((InspectionTable.DateOf)< #" & dt & "#)) ORDER BY InspectionTable.InspectionID DESC;"
Date1 = rs!DateOf
rs.MoveNext
Date2 = rs!DateOf
Me!InspectionDate = Date1
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Me!InspectionDate = Date1 (this is where the error lies)
Inspection Date is nothing more than an unbound textbox on a report....
Any help would be greatly appreciated.
Bill
Option Compare Database
Private Sub Report_Open(Cancel As Integer)
Dim db As Database
Dim rs As Recordset
Dim Date1 As Date
Dim Date2 As Date
Dim CompanyID As Long
Dim dt As Date
CompanyID = [Forms]![Main Menu]![Customer ID]
dt = Date
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT TOP 2 InspectionTable.InspectionID, InspectionTable.CompanyID, InspectionTable.DateOf FROM InspectionTable WHERE (((InspectionTable.CompanyID)= " & CompanyID & "
Date1 = rs!DateOf
rs.MoveNext
Date2 = rs!DateOf
Me!InspectionDate = Date1
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Me!InspectionDate = Date1 (this is where the error lies)
Inspection Date is nothing more than an unbound textbox on a report....
Any help would be greatly appreciated.
Bill