Results 1 to 2 of 2
  1. #1
    Join Date
    May 2013
    Posts
    1

    Unanswered: Filter Subform By Main Form Date Combo Box

    Hello,

    Currently I have a main form w/ subform. In the main form, a user selects bond's serial number from a combo box and the subform displays the bond's returns for the months owned along with a start date (each month has its own start date). So if we owned a bond from January to March, it will display the three months' returns. I want to add two combo boxes (Beginning and End Date) so that I can filter the subform to only show a particular set of months' returns.

    I have three tables right now: Cusips (lists each bond's serial number), CusipStartPK (lists the monthly returns for each serial number), and ParameterDates (list of four start dates--ie 13-01-01 for January, 13-02-01 for Feb, etc.) The main form and subform are linked via table relationship between Cusips and CusipStartPK.

    I've tried parameter queries and vba codes from other threads but I can't get this to work. Any help would be greatly appreciated and I can answer any further questions.
    Last edited by steve042; 05-28-13 at 12:22.

  2. #2
    Join Date
    Jan 2005
    Posts
    146
    First, I would not use comboboxes to select dates, just an unbound text box formatted for dates. In your subform I would put a criteria for the Date fields that are tied to the main forms StartDate and EndDate fields.

    For StartDate:
    >=Nz([Forms]!Main!StartDate,#01/01/1900#)

    For EndDate:
    <=Nz([Forms]!Main!EndDate,date())

    Then, in the StartDate and EndDate fields on your main form use the After Update events to requery your subform: Me.subformName.requery

Posting Permissions

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