Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2015
    Posts
    11

    Trouble with filtering underlying form


    I am a beginner so bare with me.

    Trying to run the below filter on an underlying form but it only works the first time. Any ideas?

    If Forms![Master Pre-op Patient Form]![Combo108] = "All" And Forms![Master Pre-op Patient Form]![Combo144] = "All" Then
    Forms![Master Pre-op Patient Form].Filter = "[Initial Consult Date] Between [TempVars]![Start Date] And [TempVars]![End Date]"
    Forms![Master Pre-op Patient Form].FilterOn = True
    End If

    Master Pre-op Patient Form has two combo boxes on it. and if both say "All," then I want the form to filter based on the two Temp Vars. First time I run it this it works, then every time after it does not use the updated values for Start Date and End Date and uses the values from the first time Start Date and End Date were set. I am stumped. I have even added two Unbound Boxes set to Start Date and End Date just to see the value passed to the obve function. They seem to be correct values but the form is only filtered to the values set the first time.

    Sorry if the above does not makes sense

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    If the cbo Combo108 and 144 are in the master form then you only need to call the cbo name, not the full path...
    if Combo108 = "All" and combo144 = "All" then
    Me.filter = "[field] between #" & txtDateFrom & "# and #" & txtDateTO & "#"
    Me.filterOn = true.
    end if

    (What if this condition is false)??

    But queries need the full path.

  3. #3
    Join Date
    Jul 2015
    Posts
    11
    Thanks for the reply.

    The cbo boxes are in the master form but I am referring to them from another form which opens up as a pop-up for the person to select start date and end date. So the "Select Dates Form pops up and the person selects the dates and when he hits a button on this form, the underlying table then filters based on the two combobox which are on the underlying master form and the dates which are the TempVars.
    I think I may have to refer to {initial Consult Date] in its full form also and give that a try. Will let you know, but thanks for the advice. I just don't understand why it actually work the first time I do it but not subsequently. I have to close the master form, then re-open and then it works again for 1 time.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 09-02-2014, 10:07 AM
  2. Replies: 1
    Last Post: 08-29-2014, 04:15 PM
  3. Form not updating underlying table
    By Kirsti in forum Forms
    Replies: 8
    Last Post: 02-10-2012, 12:23 AM
  4. Access Requery of underlying Form
    By tcheck in forum Access
    Replies: 1
    Last Post: 11-17-2011, 10:58 AM
  5. underlying form prints instead of report
    By usmcgrunt in forum Reports
    Replies: 1
    Last Post: 09-17-2010, 05:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums