Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    5

    Red face Unanswered: Combobox Select All or single dates

    Combobox selecting All
    I have a combo box where I would like to select either by Month year or All.
    When I open the form and select from the combobox say 092003 the data shows correctly then I select all and the data shows all. but when I go back and select another month/year it still shows me all.
    How would I correct this.
    Code below.

    Thanks


    Row Source Type = Table/Query

    Row Source = SELECT [Earned Doctorates Institutions Workload Query].Workload FROM [Earned Doctorates Institutions Workload Query] UNION SELECT "(ALL)" FROM [Earned Doctorates Institutions Workload Query] ORDER BY [Earned Doctorates Institutions Workload Query].Workload;


    CODE =
    Dim Fltr1 As String

    Private Sub cboworkload_AfterUpdate()
    If cboworkload = "(all)" Then
    Fltr1 = ""

    Else
    Fltr1 = "[Workload] like '" & cboworkload & "' "

    End If

    Me.Filter = Fltr1
    Me.Requery
    Me.Refresh


    End Sub

    Private Sub Form_Open(Cancel As Integer)

    Me.Filter = ""
    Me.FilterOn = True
    Me.Requery
    Me.Refresh

    End Sub

  2. #2
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Re: Combobox Select All or single dates

    Originally posted by ballcap
    Combobox selecting All
    I have a combo box where I would like to select either by Month year or All.
    When I open the form and select from the combobox say 092003 the data shows correctly then I select all and the data shows all. but when I go back and select another month/year it still shows me all.
    How would I correct this.
    Code below.

    Thanks


    Row Source Type = Table/Query

    Row Source = SELECT [Earned Doctorates Institutions Workload Query].Workload FROM [Earned Doctorates Institutions Workload Query] UNION SELECT "(ALL)" FROM [Earned Doctorates Institutions Workload Query] ORDER BY [Earned Doctorates Institutions Workload Query].Workload;


    CODE =
    Dim Fltr1 As String

    Private Sub cboworkload_AfterUpdate()
    If cboworkload = "(all)" Then
    Fltr1 = ""

    Else
    Fltr1 = "[Workload] like '" & cboworkload & "' "

    End If

    Me.Filter = Fltr1
    Me.Requery
    Me.Refresh


    End Sub

    Private Sub Form_Open(Cancel As Integer)

    Me.Filter = ""
    Me.FilterOn = True
    Me.Requery
    Me.Refresh

    End Sub
    Have you tried placing Me.FilterOn = True into the AfterUpdate event? (just like you have in the Form Open event) ...I'm not sure if it'll fix your problem, but I know that the FilterOn property applies the new filter... so maybe???.... Give it a shot...

    HTH

  3. #3
    Join Date
    Dec 2003
    Posts
    5

    Talking Re: Combobox Select All or single dates

    Originally posted by Trudi
    Have you tried placing Me.FilterOn = True into the AfterUpdate event? (just like you have in the Form Open event) ...I'm not sure if it'll fix your problem, but I know that the FilterOn property applies the new filter... so maybe???.... Give it a shot...

    HTH

    Thanks alot!!
    You were right that's all it needed.
    How stupid of me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •