- Joined
- Jul 18, 2014
- Messages
- 3
- Reaction score
- 0
I have the following issue. I have a form with a subform that gets data from a table.
I have different queries set up to provide filtered results based on the individual queries.
How can I set macro buttons up in the main form that would allow an existing query to filter the subform and provide the data results of that query in the subform?
I tried the below process I Googled and this did not work at all.
Any assistance would be greatly appreciated!!
I have different queries set up to provide filtered results based on the individual queries.
How can I set macro buttons up in the main form that would allow an existing query to filter the subform and provide the data results of that query in the subform?
I tried the below process I Googled and this did not work at all.
Private Sub RecordsetFromSQL_DAO_Click()
' Comments: Browse a query and display its fields in the Immediate Window using DAO
Const cstrQueryName = "qrySelect_TaskDueDates_AllDueDates_EarlyOnTime"
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
' Open pointer to current database
Set dbs = CurrentDb
' Open recordset on saved query
Set rst = dbs.OpenRecordset(cstrQueryName)
' Display data from one record and move to the next record until finished
Do While Not rst.EOF
Debug.Print "Position: " & rst![Position] & " Category: " & rst![Category] & " Due Date: " & rst![DueDate] & " Task: " & rst![Task] & " SubTask: " & rst![SubTask] & " Start Date: " & rst![StartDate] & " Completion Date: " & rst![CompletionDate] & " Comments: " & rst![Comments]
rst.MoveNext
Loop
rst.Close
dbs.Close
End Sub
Any assistance would be greatly appreciated!!