Results 1 to 12 of 12
  1. #1
    Metrazal is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2014
    Posts
    9

    Parameter Blues..

    I have a situation where I have created a query and I want to prompt the user for specific criteria. Therefore in the criteria field I type [Enter Item Number:] When I run the query I get a prompt and I input 12345 in the input box and press ok. Unfortunately, I get no results from my querry. However, if I type = "12345" in the criteria field and run the query, I get the returns I expect. Any help in resolving this issue would be appreciated.




    Thanks,

    MET

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Try converting it to string by surrounding the param....CSTR( [Enter Item Number:])

  3. #3
    Metrazal is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2014
    Posts
    9
    Quote Originally Posted by ranman256 View Post
    Try converting it to string by surrounding the param....CSTR( [Enter Item Number:])
    Darn. I was hoping your suggestion would work but no cigar. Same Results. Thanks for the suggestion in any case.


    MET

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    That is odd because you dont have to enter quotes around a param to get results. I do it all the time.
    Unless your values ACTUALLY have the quotes in the table.

  5. #5
    Metrazal is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2014
    Posts
    9
    Actually, you can type =12345 in the criteria and get the desired results also. I included the quotes because Access auto inserts the quotes if you do not include them. Again, thanks for the reply.

    MET

  6. #6
    Metrazal is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2014
    Posts
    9
    Quote Originally Posted by Metrazal View Post
    Actually, you can type =12345 in the criteria and get the desired results also. I included the quotes because Access auto inserts the quotes if you do not include them. Again, thanks for the reply.

    MET
    Still no luck. Can I build an event in a form to have a user input this criteria? Using [Enter Info] parameter just does not seem to work.


    Thanks,

    MET

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Most of us would use a form to gather the user input anyway; you have a lot more control over the process that way. Instead of [Enter...] in the criteria, you'd have:

    Forms!FormName.TextboxName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,616
    Agree with pbaldy.

    I NEVER use dynamic input popup prompts.

    Review http://www.datapigtechnologies.com/f...tomfilter.html

    But I don't use dynamic parameter queries. I use:

    DoCmd.OpenForm "form name", , , "Item='" & Me.textboxName & "'"

    Regardless, it does seem odd that your popup prompt doesn't work.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    Would be nice to see the SQL of the query, to see how the parameter is used.

  10. #10
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    try using cstr([Fieldname]) on the field you're searching then putting in the criteria cstr([Enter the String]) (or whatever you want your prompt to be, this would force both the field and the search string to be strings in case one or the other is not.

  11. #11
    Metrazal is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2014
    Posts
    9
    Thanks to everyone for their input. To resolve this issue I added a wild-card to the parameter. Like [ENTER ITEM NUMBER:] & "*" My data must have had some hidden spaces in it but not sure why it worked when I manually input the criteria without wildcards. Anyway, once again thanks for the suggestions.

  12. #12
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if you trim the field you're entering the dynamic criteria for you should be fine too..

    create a field based on the field you're searching and do something like TestValue: trim([Fieldname])

    Then in your criteria

    [Enter Item Number] should work just fine.

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

Similar Threads

  1. Military Time Blues
    By viperbyte in forum Forms
    Replies: 19
    Last Post: 04-14-2020, 06:45 AM
  2. Expression Builder Blues
    By justphilip2003 in forum Forms
    Replies: 8
    Last Post: 05-19-2013, 03:28 PM
  3. Replies: 1
    Last Post: 02-28-2013, 01:20 PM
  4. Slow Form Blues
    By mickeymatos in forum Forms
    Replies: 2
    Last Post: 12-12-2012, 03:15 PM
  5. Hesitation production psychological SQL Blues
    By byterbit in forum Queries
    Replies: 1
    Last Post: 05-11-2011, 02:36 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