Hello,
I have problem retrieving data from recordset.
code sample:
Sub TrialCodes()
Dim R As Variant
Dim record As Recordset
Dim SQL As String
Dim data As Database
Set data = CurrentDb
SQL = "SELECT DISTINCT Data.[TrialCode] FROM data WHERE Data.[TrialCode] Is Not Null And Data.[TrialCode]<>'';"
Set record = data.OpenRecordset(SQL)
record.MoveLast
record.MoveFirst
R = record.GetRows(record.RecordCount)
For intJ = 1 To UBound(R, 1)
DoCmd.RunSQL "INSERT INTO testi (TrialCodes) VALUES (" & R(intJ) & "
"
Next intJ
record.Close
Set data = Nothing
End Sub
Problem here is that R doesn't get any data from record.GetRows. I can see with debug that record.RecordCount is 8, so there must be data.
Any help would be appreciated!!!
Thanks...
I have problem retrieving data from recordset.
code sample:
Sub TrialCodes()
Dim R As Variant
Dim record As Recordset
Dim SQL As String
Dim data As Database
Set data = CurrentDb
SQL = "SELECT DISTINCT Data.[TrialCode] FROM data WHERE Data.[TrialCode] Is Not Null And Data.[TrialCode]<>'';"
Set record = data.OpenRecordset(SQL)
record.MoveLast
record.MoveFirst
R = record.GetRows(record.RecordCount)
For intJ = 1 To UBound(R, 1)
DoCmd.RunSQL "INSERT INTO testi (TrialCodes) VALUES (" & R(intJ) & "
Next intJ
record.Close
Set data = Nothing
End Sub
Problem here is that R doesn't get any data from record.GetRows. I can see with debug that record.RecordCount is 8, so there must be data.
Any help would be appreciated!!!
Thanks...