Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2014
    Posts
    2

    Unanswered: Combo Box Row Source

    Hi this is my first post so please bear with me..... I have a form within MS Access that when opened asks for a parameters to be entered into the "Period" field and the form then displays all records that apply to that period. On the form I also have a Combo Box which is used to list all records and search / take you to the relevant record to save you having to click through them all individually. It has some code After Update which lists all the records and when a record is selected from the list, then takes you to the relevant record. The only problem is that even though the form contains the filtered records based on the parameters input, the list in the Combo Bow List doesnt so when I look at the list is contains all records as opposed to those within the parameters of the form. Is there any way the Combo Box can also be filtered to reflect the paramters of the form as opposed to the user having to input a parameter when opening the form and also when wanting to search for a record using the Combo Box Search?

    Hope you are following what Im asking but totally understand if your not because its gone on a bit!!

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    use the same 'where' clause for the combo box rowsource in your form
    the 'where' clause is effectively the same as the filter but prefixed with WHERE

    say your requirement is-
    rows where the userid equals spandy34 AND rows whose datecolumn is greater than or equal to the start of this month*
    so the filter is:-
    Code:
    "UserID = 'spandy34' AND Datecolumn >= #" & format(date(),"YYYY/MM") & "/01#"
    a where clause would be
    Code:
    "WHERE UserID = 'spandy34' AND Datecolumn >= #" & format(date(),"YYYY/MM") & "/01#"
    that WHERE clause needs to be added to the select part
    Code:
    SELECT my, column, list FROM mytable WHERE UserID = 'spandy34' AND Datecolumn >= #" & format(date(),"YYYY/MM") & "/01#"
    * date literals in Access must be delimited by # and either ISO (YYYY/MM/DD) or US format MM/DD/YYYY.
    text literals delimited by either ' or "
    numeric literals do not need to be delimited, so shouldn't be.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2014
    Posts
    2

    Thumbs up

    Thank you so much for your response... great help

Posting Permissions

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