Results 1 to 8 of 8
  1. #1
    techexpressinc's Avatar
    techexpressinc is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2008
    Location
    Indiana, USA
    Posts
    151

    Passing Multiple selection values to a report

    I have a form with this behind the button to select one associate to appear on the report, it works.



    Now, I need to add another parameter. Besides the associate, I need to add the Market as parameter. I am have trouble getting the syntax correct for the and.

    Can someone give an idea of how to add one more parameter. I tried the word "and", "&" without success.

    Thx Russ


    Below is current working code:

    Code:
     
    DoCmd.OpenReport "rpt_PIM_bjk_4_2006", acViewPreview, , "PIandM = '" & Me.AssociateListing & "'"
    

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Try this:

    Quote Originally Posted by techexpressinc View Post
    I have a form with this behind the button to select one associate to appear on the report, it works.

    Now, I need to add another parameter. Besides the associate, I need to add the Market as parameter. I am have trouble getting the syntax correct for the and.

    Can someone give an idea of how to add one more parameter. I tried the word "and", "&" without success.

    Thx Russ


    Below is current working code:

    Code:
     
    DoCmd.OpenReport "rpt_PIM_bjk_4_2006", acViewPreview, , "PIandM = '" & Me.AssociateListing & "' AND Marketvar = '" & Me.Market & "'"
    
    
    The spaces around the AND are important.
    HTH

  3. #3
    techexpressinc's Avatar
    techexpressinc is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2008
    Location
    Indiana, USA
    Posts
    151

    Still getting a syntax error - more help needed

    It is rough to get the right combo of commas, single and double quotes. I tried a few variations without success.

    Below is a snapshot of the code. I left the working line in there commented out then the next one line with the second variable that is not working. It is getting the message method or data member not found highlighting the .Associatelisting.

    Code:
    '  DoCmd.OpenReport "rpt_PIM_bjk_4_2006", acViewPreview, , "PIandM = '" & Me.AssociateListing & "'"
    
    DoCmd.OpenReport "rpt_PIM_bjk_4_2006", acViewPreview, , "PIandM = '" & Me.AssociateListing & "' AND Marketproduct = '" & Me.MarketProduct & "'"

  4. #4
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    The addition to the 'where' specification has a field name the same as

    a control name, i.e. MarketProduct? If so, perhaps the names need additonal reference qualification, e.g. forms![formname]![controlname] although 'me' has always worked for me in referencing form objects. Maybe the field reference needs qualification. Other than that possiblity, I don't see anything wrong.

  5. #5
    techexpressinc's Avatar
    techexpressinc is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2008
    Location
    Indiana, USA
    Posts
    151

    looked to missing a double quote before the AND

    but when I added it - I still got a syntax error.

    If I ever get figured out I will make sure I post the code that works.

    Russ

  6. #6
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Could you try the second part of the query by itself, i.e.

    "MarketProduct = '" & Me.MarketProduct & "'" to be sure that it works?

    Quote Originally Posted by techexpressinc View Post
    but when I added it - I still got a syntax error.

    If I ever get figured out I will make sure I post the code that works.

    Russ

  7. #7
    techexpressinc's Avatar
    techexpressinc is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2008
    Location
    Indiana, USA
    Posts
    151

    good tip not there yet thou

    Me.MarketProduct = was a not found item

  8. #8
    techexpressinc's Avatar
    techexpressinc is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2008
    Location
    Indiana, USA
    Posts
    151

    identifying my Marketproduct field

    I might need to go to the "forms![formname]![controlname] " to get a hold of the field.
    Attached is a screen print of the from with the MarketProduct drop-down box properties.

    Russ

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

Similar Threads

  1. Selecting multiple values to be used in a report.
    By mnsemple83 in forum Reports
    Replies: 1
    Last Post: 08-12-2011, 05:10 PM
  2. passing values between forms
    By paulw in forum Access
    Replies: 4
    Last Post: 06-15-2011, 08:52 AM
  3. PASSING Values between Forms
    By chhinckley in forum Programming
    Replies: 1
    Last Post: 08-27-2010, 10:19 AM
  4. Passing variable values to Stored Procedure
    By rodrigopcnet in forum Access
    Replies: 1
    Last Post: 04-14-2010, 10:35 AM
  5. Passing Values
    By dromorkid in forum Forms
    Replies: 0
    Last Post: 11-25-2008, 05:04 PM

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