Results 1 to 4 of 4
  1. #1
    Join Date
    May 2007
    Posts
    12

    Unanswered: DoCmd Open Form with Filter and Passing Args

    I am using the following code in my program and the Args pass fine
    but I am unable to get the Filter part to work. Can someone check this
    out and let me know whats up. Thanks for your help

    DoCmd.OpenForm "Frm_1065_Input_New", acNormal, "[Partnership Name]= [SelectedPartnershipName] and [EnteredYear]= [SelectedYear] and [ACTS Entity]= [SelectedACTSEntity]", , acFormEdit, acWindowNormal, [SelectedYear] & ";" & [SelectedParent] & ";" & [SelectedPartnershipName] & ";" & [SelectedAACTSEntity]

    PartnershipName = Text
    SelectedParent = Variant (Defined in procedure)
    EnteredYear = Date/Time
    SeletedYear = Variant (Defined in procedure)
    ACTSEntity = Text
    SelectedACTSEntity = Variant (Defined in procedure)

    When I remove the Filter the Passing Args are fine
    When I put back the Filter the Passing Args are fine

    again tkx for help

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    dwweibel,

    You need to do two things: (1) put your filter, which requires an object, as a WHERE clause, and (2) change the text of that clause. To wit:

    Change ---> DoCmd.OpenForm "Frm_1065_Input_New", acNormal, "[Partnership Name]= [SelectedPartnershipName] and [EnteredYear]= [SelectedYear] and [ACTS Entity]= [SelectedACTSEntity]", , acFormEdit, acWindowNormal, [SelectedYear] & ";" & [SelectedParent] & ";" & [SelectedPartnershipName] & ";" & [SelectedAACTSEntity]

    To:
    Code:
    DoCmd.OpenForm "Frm_1065_Input_New", acNormal, , "[Partnership Name]= '" & [SelectedPartnershipName] & "' and [EnteredYear]= '" & [SelectedYear] & "' and [ACTS Entity]= '" & [SelectedACTSEntity]" & "'" , acFormEdit, acWindowNormal, [SelectedYear] & ";" & [SelectedParent] & ";" & [SelectedPartnershipName] & ";" & [SelectedAACTSEntity]
    I put in the code tags so you can clearly differentiate between the single quotes and the double quotes. Also, note that I changed the positions of two of the commas to change the FILTER to a WHERE clause.

    Hope this Helps,

    Sam

  3. #3
    Join Date
    May 2007
    Posts
    12

    Smile

    Thank you very much .. I decided to try and put it as a Where clause
    to see if it worked that just befor I came back here to check for
    any answers ... and wow ...it works great. HEHEHEHEHEHE
    Ah the life of putting things in the wrong spot.
    Again thanks .. appreciate the help (New to this site and finding
    out everyone here is very helpfull and I appreciate the help alot)
    Again Thanks ..

  4. #4
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    You're welcome.

Posting Permissions

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