Sorry, if covered before but I'm struggling with something I think should be very easy.
I have a form which exports data from a query. I just want to run an SQLstr that counts record in the query so as to present a Msgbox saying "x number of records exported"
The code below just returns a zero records even though it is 250!?
I have a form which exports data from a query. I just want to run an SQLstr that counts record in the query so as to present a Msgbox saying "x number of records exported"
The code below just returns a zero records even though it is 250!?
Code:
Private Sub Command261_Click()
Dim SQLStr As String
Dim NoOfDataRows As Integer
SQLStr = "SELECT Count(Qry_Dist1_Z_Desp_Total_Cost_2.Sub_Cat) AS CountOfSub_Cat " & _
"FROM Qry_Dist1_Z_Desp_Total_Cost_2;"
Export_No.Value = SQLStr
Export_No.Requery
NoOfDataRows = Export_No.Value
MsgBox "Export Complete...." & vbCrLf & NoOfDataRows & " Rows Exported", vbOKOnly, "Computer Says...."
End Sub
Comment