The following code gives me a runtime error '3001' Invalid argument.
Debuging points to the red line.
All I want is that rec will be equal to the record count of query "Qlegendorder"
What is the mistake with the code?
or
What shall write instead of the red line?
Dim strSQL, strIn As String
Dim i, rec As Integer
strSQL = "TRANSFORM Max(tgraph.Time) AS MaxOfTime SELECT tgraph.Numbers FROM Legend INNER JOIN tgraph ON Legend.[Legend name] = tgraph.Name GROUP BY tgraph.Numbers, tgraph.Time ORDER BY tgraph.Numbers, tgraph.Time DESC PIVOT Legend.Legend"
DoCmd.OpenQuery "Qlegendorder", acViewNormal, acEdit
DoCmd.GoToRecord acQuery, "Qlegendorder", acFirst
rec = CurrentDb.QueryDefs("Qlegendorder").OpenRecordset(Dynaset).RecordCount
For i = 1 To rec
strIn = strIn & " '" & Legend & "'"
DoCmd.GoToRecord acQuery, "Qlegendorder", acNext
Next
Debuging points to the red line.
All I want is that rec will be equal to the record count of query "Qlegendorder"
What is the mistake with the code?
or
What shall write instead of the red line?
Dim strSQL, strIn As String
Dim i, rec As Integer
strSQL = "TRANSFORM Max(tgraph.Time) AS MaxOfTime SELECT tgraph.Numbers FROM Legend INNER JOIN tgraph ON Legend.[Legend name] = tgraph.Name GROUP BY tgraph.Numbers, tgraph.Time ORDER BY tgraph.Numbers, tgraph.Time DESC PIVOT Legend.Legend"
DoCmd.OpenQuery "Qlegendorder", acViewNormal, acEdit
DoCmd.GoToRecord acQuery, "Qlegendorder", acFirst
rec = CurrentDb.QueryDefs("Qlegendorder").OpenRecordset(Dynaset).RecordCount
For i = 1 To rec
strIn = strIn & " '" & Legend & "'"
DoCmd.GoToRecord acQuery, "Qlegendorder", acNext
Next