P
patti
I have a report that has the following code in its On Open event:
================================
Private Sub Report_Open(Cancel As Integer)
Dim db As Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim strLastDate As String
Dim strMessage As String
Set db = CurrentDb
strSQL = "SELECT lastRun " & _
"FROM tblLastRun " & _
"WHERE file_Type = 'OO' "
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
strLastDate = rs!lastrun
rs.Close
Set db = Nothing
strMessage = "This data was last updated on " & Trim(Format(strLastDate,
"Short Date")) & " at " & _
Format(Trim(strLastDate), "hh:mm AM/PM") & ". " & Chr(13) & _
"Would you like to refresh it now? "
If MsgBox(strMessage, vbQuestion + vbYesNo, "Refresh Data") = vbYes Then
fnPopulateTable_2
Set db = CurrentDb
strSQL = "UPDATE tblLastRun " & _
"SET lastRun = #" & Now() & "# " & _
"WHERE file_Type = 'OO' "
db.Execute strSQL
Set db = Nothing
End If
End Sub
=================================
It worked fine last week (it is run weekly). Now, i say yes to prompt to
update data and then i just hang. I have compacted & repaired db. The
tblLastRun is a linked table and appears to be fine in that db.
(If i say no, don't update, i roll merrily along & see last week's reports
fine.
How can i find out what is going wrong?
thanks.
patti
================================
Private Sub Report_Open(Cancel As Integer)
Dim db As Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim strLastDate As String
Dim strMessage As String
Set db = CurrentDb
strSQL = "SELECT lastRun " & _
"FROM tblLastRun " & _
"WHERE file_Type = 'OO' "
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
strLastDate = rs!lastrun
rs.Close
Set db = Nothing
strMessage = "This data was last updated on " & Trim(Format(strLastDate,
"Short Date")) & " at " & _
Format(Trim(strLastDate), "hh:mm AM/PM") & ". " & Chr(13) & _
"Would you like to refresh it now? "
If MsgBox(strMessage, vbQuestion + vbYesNo, "Refresh Data") = vbYes Then
fnPopulateTable_2
Set db = CurrentDb
strSQL = "UPDATE tblLastRun " & _
"SET lastRun = #" & Now() & "# " & _
"WHERE file_Type = 'OO' "
db.Execute strSQL
Set db = Nothing
End If
End Sub
=================================
It worked fine last week (it is run weekly). Now, i say yes to prompt to
update data and then i just hang. I have compacted & repaired db. The
tblLastRun is a linked table and appears to be fine in that db.
(If i say no, don't update, i roll merrily along & see last week's reports
fine.
How can i find out what is going wrong?
thanks.
patti