Change Combo's display after Row Source is changed

  • Thread starter Thread starter Evi
  • Start date Start date
E

Evi

I'm changing my Combo's (cboToDate) Row Source using code in another combo
(cboFromDate) but although cboFromDate's After Update code includes the line
Me.cboToDate.Requery,
cboToDate will still show the data it had in it, before I used cboFromDate
and will only display the new data when I click on cboToDate. Ideally, I
would like it to display whatever date I chose in cboFromDate but when I
click it, I want cboToDate to show all the later dates too. Is this
possible?

The code I have makes cboToDate show all the dates in a query unless I
choose a date with cboFromDate, then I only want it to show dates that are
on or later than that in cboFromDate. It gives me greater options on how to
filter a report.

The code I have is as follows:
Private Sub Form_Open(Cancel As Integer)
If IsNull(Me.cboFromDate) Then
Me.cboToDate.RowSource = "SELECT QryWkDates.WkDate FROM QryWkDates"
Else
Me.cboToDate.RowSource = "SELECT QryWkDates.WkDate FROM QryWkDates WHERE
(((QryWkDates.WkDate)>=[Forms].[FrmChooseReport].[cboFromDate]));"
'cboToDate shows all the dates in the query
End If
End Sub


Private Sub cboFromDate_AfterUpdate()
Me.cboToDate.RowSource = "SELECT QryWkDates.WkDate FROM QryWkDates WHERE
(((QryWkDates.WkDate)>=[Forms].[FrmChooseReport].[cboFromDate]));"
'cboToDate now only shows those dates
'that are >= to the date chosen in cboFromDate
Me.cboToDate.Requery
End Sub

Evi
 
Hi Evi

To your cboFromDate_AfterUpdate procedure, add the line:

cboToDate = cboFromDate
 
Thanks Graham, that's great!
Evi

Graham Mandeno said:
Hi Evi

To your cboFromDate_AfterUpdate procedure, add the line:

cboToDate = cboFromDate

--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Evi said:
I'm changing my Combo's (cboToDate) Row Source using code in another combo
(cboFromDate) but although cboFromDate's After Update code includes the
line
Me.cboToDate.Requery,
cboToDate will still show the data it had in it, before I used cboFromDate
and will only display the new data when I click on cboToDate. Ideally, I
would like it to display whatever date I chose in cboFromDate but when I
click it, I want cboToDate to show all the later dates too. Is this
possible?

The code I have makes cboToDate show all the dates in a query unless I
choose a date with cboFromDate, then I only want it to show dates that are
on or later than that in cboFromDate. It gives me greater options on how
to
filter a report.

The code I have is as follows:
Private Sub Form_Open(Cancel As Integer)
If IsNull(Me.cboFromDate) Then
Me.cboToDate.RowSource = "SELECT QryWkDates.WkDate FROM QryWkDates"
Else
Me.cboToDate.RowSource = "SELECT QryWkDates.WkDate FROM QryWkDates WHERE
(((QryWkDates.WkDate)>=[Forms].[FrmChooseReport].[cboFromDate]));"
'cboToDate shows all the dates in the query
End If
End Sub


Private Sub cboFromDate_AfterUpdate()
Me.cboToDate.RowSource = "SELECT QryWkDates.WkDate FROM QryWkDates WHERE
(((QryWkDates.WkDate)>=[Forms].[FrmChooseReport].[cboFromDate]));"
'cboToDate now only shows those dates
'that are >= to the date chosen in cboFromDate
Me.cboToDate.Requery
End Sub

Evi
 
Back
Top