R
ruomingxu
I have a problem with recordset/SQL statement. The following is the code.
Private Sub Command1_Click()
Dim SqlQuery As String
Dim RcdSet As Recordset
Dim cnt As Integer
SqlQuery = "SELECT * FROM temp_test;"
Set RcdSet = CurrentDb.OpenRecordset(SqlQuery
cnt = RcdSet.RecordCount
RcdSet.Close
End Sub
The table "temp_test" has 6 rows. The variable cnt should return a number
"6" but instead a "1". Is there something wrong with the SQL statement? But
if I use this one:
Set RcdSet = CurrentDb.OpenRecordset("temp_test")
the variable cnt returns a number "6".
Why? Please help and thanks.
Private Sub Command1_Click()
Dim SqlQuery As String
Dim RcdSet As Recordset
Dim cnt As Integer
SqlQuery = "SELECT * FROM temp_test;"
Set RcdSet = CurrentDb.OpenRecordset(SqlQuery
cnt = RcdSet.RecordCount
RcdSet.Close
End Sub
The table "temp_test" has 6 rows. The variable cnt should return a number
"6" but instead a "1". Is there something wrong with the SQL statement? But
if I use this one:
Set RcdSet = CurrentDb.OpenRecordset("temp_test")
the variable cnt returns a number "6".
Why? Please help and thanks.