I
Ian Shaw
Hi Guys,
Please help me!! I am trying to determine the record count of a query using
the following code: I know that it needs some help!
Dim db As Database
Dim rs As Recordset
Dim qdf As QueryDef
Dim str As String
Dim chk As Single
chk = [Forms]![ReportSelectorForm]![Combo7]
str = "SELECT EmployeeTraining.LicenceID, EmployeeTraining.EmployeeID,
EmployeeTraining.[Date Completed], EmployeeTraining.[Expiry Date] " & _
"FROM EmployeeTraining " & _
"WHERE (((EmployeeTraining.LicenceID)= " & chk & ")); "
Set db = DBEngine(0)(0)
Set qdf = db.CreateQueryDef("", str)
rs = qdf.OpenRecordset
If Not qdf.EOF Then
rs.MoveLast
Debug.Print rs.RecordCount
Else
Debug.Print "No records retured"
End If
Unfortunately for me I do not know how to fix it!! I have tried every
permuation that I can think of and to no avail!
Any assistance would be inavaluable!!
Cheers
Please help me!! I am trying to determine the record count of a query using
the following code: I know that it needs some help!
Dim db As Database
Dim rs As Recordset
Dim qdf As QueryDef
Dim str As String
Dim chk As Single
chk = [Forms]![ReportSelectorForm]![Combo7]
str = "SELECT EmployeeTraining.LicenceID, EmployeeTraining.EmployeeID,
EmployeeTraining.[Date Completed], EmployeeTraining.[Expiry Date] " & _
"FROM EmployeeTraining " & _
"WHERE (((EmployeeTraining.LicenceID)= " & chk & ")); "
Set db = DBEngine(0)(0)
Set qdf = db.CreateQueryDef("", str)
rs = qdf.OpenRecordset
If Not qdf.EOF Then
rs.MoveLast
Debug.Print rs.RecordCount
Else
Debug.Print "No records retured"
End If
Unfortunately for me I do not know how to fix it!! I have tried every
permuation that I can think of and to no avail!
Any assistance would be inavaluable!!
Cheers