Results 1 to 6 of 6

Enter Parameter Value Message when selecting from a combo box

  1. #1
    Tron142 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jul 2011
    Posts
    7

    Enter Parameter Value Message when selecting from a combo box

    I am selecting the year from a combo box. After the year is selected, the user will click on a command button to view a report. Below is my code that performs the action required. However, once the command button is clicked, I receive a pop up box that states "ENTER PARAMETER VALUE" for cboYear.Value



    why does it do this and how do I work around it?

    Code:
        Dim stDocName As String
        Dim SelectedYear As Integer
        SelectedYear = cboYear.Value
        
        MsgBox (SelectedYear)
        stDocName = "Overall Report"
        DoCmd.OpenReport stDocName, acPreview, , "Year = cboYear.Value"
    Thanks,
    Tron

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,593
    The value has to be concatenated into the string, like so:

    http://www.baldyweb.com/wherecondition.htm

    By the way, "year" is not a good name for a field, as sooner or later Access will confuse it with the Year() function.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Tron142 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jul 2011
    Posts
    7
    I tried what was suggested in the URL you provided. I receive a message stating "Data Type mismatch in criteria expression"

    as for the "year" name.... thanks for letting me know. I'll make the adjustment.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,593
    The data type error would imply that you used the numeric syntax for a text field, or vice-versa. What exactly did you try, and what is the data type of the year field?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Tron142 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jul 2011
    Posts
    7
    Okay, so I changed my data type out to "text" instead of "number" from my main table. It's working and doing great now. Thanks for you help! Much appreciated!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,593
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Enter parameter value (subform combo)
    By AndycompanyZ in forum Queries
    Replies: 11
    Last Post: 06-22-2011, 08:33 AM
  2. enter parameter value
    By alliandrina in forum Access
    Replies: 1
    Last Post: 06-05-2011, 01:02 AM
  3. Enter Parameter Value
    By T001 in forum Access
    Replies: 1
    Last Post: 08-11-2010, 05:43 AM
  4. Enter Parameter Value
    By gutes2 in forum Forms
    Replies: 3
    Last Post: 03-03-2010, 05:03 PM
  5. Enter Parameter Value
    By plesser in forum Access
    Replies: 1
    Last Post: 11-08-2008, 10:27 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
  •  
Tech Forums: Microsoft Office Forums