G
grace
Guest
Here is my troubled code:
Private Function checkData(strRptName As String) As Integer
'check if the query for the report contains data,
'all the reports' names are in "rtp&'QueryName'"format
'all the querys' name are in "Qry& "queryname'" format
Dim strqueryName As String
Dim db As Database
Dim rst As Recordset
If Not strRptName = "" Then
strqueryName = "qry" & Mid$(Trim(strRptName), 3)
Else
checkData = 0
End If
Set db = CurrentDb
Set rst = db.OpenRecordset(strqueryName, dbOpenSnapshot)
If rst.RecordCount = 0 Then
MsgBox rst.RecordCount
checkData = 0
Else
checkData = 1
End If
End Function
The problem is that the execution process will not continue after setting the record. Basically the code from "if rst.recordcount" are never get executed? Why? I am quite confused. Please help?
Grace
Private Function checkData(strRptName As String) As Integer
'check if the query for the report contains data,
'all the reports' names are in "rtp&'QueryName'"format
'all the querys' name are in "Qry& "queryname'" format
Dim strqueryName As String
Dim db As Database
Dim rst As Recordset
If Not strRptName = "" Then
strqueryName = "qry" & Mid$(Trim(strRptName), 3)
Else
checkData = 0
End If
Set db = CurrentDb
Set rst = db.OpenRecordset(strqueryName, dbOpenSnapshot)
If rst.RecordCount = 0 Then
MsgBox rst.RecordCount
checkData = 0
Else
checkData = 1
End If
End Function
The problem is that the execution process will not continue after setting the record. Basically the code from "if rst.recordcount" are never get executed? Why? I am quite confused. Please help?
Grace