TinkerMan
Dooh!
- Local time
- Today, 21:52
- Joined
- Jan 12, 2005
- Messages
- 35
Hi all
I have a summarised sub-form, based on dates, so I have to use a crosstab query. Because of the varying column names (dates), I'm using VBA to create the query. In addition the underlying query has a parameter that needs to be set. I have the code in a function (below), called from the On_Current as well as the date-combo's after_update (that defines which week to display). This all works fine.
The function:
My problem started when I added filter buttons. Every time I try to use filters the parameter dialog appears asking for "start_date".
Is there a different way of setting parameters that will cause it to be remembered?
Is there a way to intercept this "refresh/requery" and run my populateForm function instead?
Thanks
I have a summarised sub-form, based on dates, so I have to use a crosstab query. Because of the varying column names (dates), I'm using VBA to create the query. In addition the underlying query has a parameter that needs to be set. I have the code in a function (below), called from the On_Current as well as the date-combo's after_update (that defines which week to display). This all works fine.
The function:
Code:
Public Function populateForm()
Dim qd As DAO.QueryDef
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Dim sql As String
sql = getOrderQuery(Me.DatePicker.value, Me.Customer_ID)
Set qd = dbs.CreateQueryDef("", sql)
qd.Parameters![start_date] = Me.DatePicker.value
Set rst = qd.OpenRecordset
Set Me.orders_subform.Form.Recordset = rst
End Function
My problem started when I added filter buttons. Every time I try to use filters the parameter dialog appears asking for "start_date".
Is there a different way of setting parameters that will cause it to be remembered?
Is there a way to intercept this "refresh/requery" and run my populateForm function instead?
Thanks