S
Santiago Gomez
Hello,
I am getting an error when I run vba code that looks at the following query:
SELECT qryCombinedKVA.Date, qryCombinedKVA.Total, qryCombinedKVA.Max,
qryCombinedKVA.Avg, qryCombinedKVA.Min
FROM qryCombinedKVA
WHERE (((qryCombinedKVA.Date) Between [Forms]![frmDateRange].[calStart] And
[Forms]![frmDateRange].[calEnd]));
The query is looking at another query for some of its data. It is also
filtering by a date range based on calendar controls on the open form.
Here is the code:
Sub RetrieveQuery()
Dim rst As New ADODB.Recordset
rst.Open "qryFormDateRangeKVA", CurrentProject.Connection, adOpenStatic
With rst
Do While Not .EOF
Debug.Print .Fields("Date")
.MoveNext
Loop
.Close
End With
End Sub
If I run this against a table it works, if I run this against a simple query
it works. Is there a limitation for queries based on sub-queries?
Thanks
I am getting an error when I run vba code that looks at the following query:
SELECT qryCombinedKVA.Date, qryCombinedKVA.Total, qryCombinedKVA.Max,
qryCombinedKVA.Avg, qryCombinedKVA.Min
FROM qryCombinedKVA
WHERE (((qryCombinedKVA.Date) Between [Forms]![frmDateRange].[calStart] And
[Forms]![frmDateRange].[calEnd]));
The query is looking at another query for some of its data. It is also
filtering by a date range based on calendar controls on the open form.
Here is the code:
Sub RetrieveQuery()
Dim rst As New ADODB.Recordset
rst.Open "qryFormDateRangeKVA", CurrentProject.Connection, adOpenStatic
With rst
Do While Not .EOF
Debug.Print .Fields("Date")
.MoveNext
Loop
.Close
End With
End Sub
If I run this against a table it works, if I run this against a simple query
it works. Is there a limitation for queries based on sub-queries?
Thanks