Results 1 to 10 of 10
  1. #1
    cp1981 is offline Advanced Beginner
    Windows 7 64bit Office 365
    Join Date
    Jul 2014
    Location
    Northeast Missouri
    Posts
    33

    "Parameter" issue when integrating filtered sub w/ form

    I had a good thing going with a text box and a listbox for a user to use to search. Now, instead of the list box I was wanting a subform. Thought it would look better. I'm literally going around in circles trying to figure out where the problem is (other than myself).

    Main Form: frmSearch
    Subform: subSearch
    Search Text Box: txtSearch
    Query: qrySearch

    Click image for larger version. 

Name:	SNapshot1.png 
Views:	21 
Size:	14.9 KB 
ID:	51650

    As from the image above, I want the user to be able to search by Account Name or the City. When I beging to type in the search box, nothing happens. But if I exit out of everything, click on either the search query or the subform I of course get the Parameter Value Message.
    Click image for larger version. 

Name:	snapshot2.png 
Views:	21 
Size:	13.7 KB 
ID:	51651
    But the query/subform work if I input the some or all the data in the message.

    Heres the YouTube link Ive replayed over and over trying to figure out what Im doing wrong. I believe I followed this to a "T" and I still get nothing.

    How to filter a subform from a textbox on main form (MS Access) (youtube.com)

    What am I overlooking?
    With the SQL, I tried the "Like "*" & [Forms]![frmSearch]![txtSearch] & "*" ", one without the Forms syntax, ive tried with and without brackets. I'm tapped.

    Ive tried using/not using the Yes/No in the Properties section of the query "Output all Fields".



    Do I need to put the "Like" syntax in with the sub as well? I feel that would be redundant as well as confusing. Just throwing it out there

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Are you sure everything is spelled correctly?

    If you want to provide db for analysis, follow instructions at bottom of my post.

    I don't use parameterized queries. I prefer VBA to build filter criteria and apply to form or report.
    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.

  3. #3
    cp1981 is offline Advanced Beginner
    Windows 7 64bit Office 365
    Join Date
    Jul 2014
    Location
    Northeast Missouri
    Posts
    33
    Quote Originally Posted by June7 View Post
    Are you sure everything is spelled correctly?

    If you want to provide db for analysis, follow instructions at bottom of my post.

    I don't use parameterized queries. I prefer VBA to build filter criteria and apply to form or report.
    Even with editing most of the DB and zipping it, I'm almost 1.5MB too big to send.

    Maybe my fine-toothed comb has a few missing teeth, but I can try to see if there is anything misspelled again. I've done my level best to be sure i crossed every "T" dotted every "I", see if I single quoted instead of double quoting. Question: When writing an expression with not having any spaces or special characters in the naming, do brackets versus none, exclamation versus period matter? I've seen it typed every which way it seems or the DB deletes the brackets when I look at SQL and puts periods where I put exclamation.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Including brackets around object names will not hurt. I've never seen query drop them. If query changes ! to . then accept that.

    You ran compact and repair? Make a copy and delete what is not needed, including most data?
    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.

  5. #5
    cp1981 is offline Advanced Beginner
    Windows 7 64bit Office 365
    Join Date
    Jul 2014
    Location
    Northeast Missouri
    Posts
    33
    CopyDB (4).zip
    Quote Originally Posted by June7 View Post
    Including brackets around object names will not hurt. I've never seen query drop them. If query changes ! to . then accept that.

    You ran compact and repair? Make a copy and delete what is not needed, including most data?
    I wasnt thinking all the way. Deleted everything other than the goods.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Advise not to use punctuation/special characters in naming convention - that means the ? in IsActive? so go away.

    Suggest don't need to specify those two fields in SELECT clause because you have * wildcard. This is repeating those two fields in query output (Access assigns an alias name to dupes). And include criteria for City.

    SELECT *
    FROM tblAccounts
    WHERE (((tblAccounts.AccountName) Like "*" & [txtSearch] & "*")) OR (((tblAccounts.City) Like "*" & [txtSearch] & "*"));

    Instead of an SQL statement in RecordSource, just reference query name.

    All works for me - no popup.

    Suggest placing the search box and any buttons in form header instead of detail section.
    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.

  7. #7
    cp1981 is offline Advanced Beginner
    Windows 7 64bit Office 365
    Join Date
    Jul 2014
    Location
    Northeast Missouri
    Posts
    33
    Quote Originally Posted by June7 View Post
    Advise not to use punctuation/special characters in naming convention - that means the ? in IsActive? so go away.

    Suggest don't need to specify those two fields in SELECT clause because you have * wildcard. This is repeating those two fields in query output (Access assigns an alias name to dupes). And include criteria for City.

    SELECT *
    FROM tblAccounts
    WHERE (((tblAccounts.AccountName) Like "*" & [txtSearch] & "*")) OR (((tblAccounts.City) Like "*" & [txtSearch] & "*"));

    Instead of an SQL statement in RecordSource, just reference query name.

    All works for me - no popup.

    Suggest placing the search box and any buttons in form header instead of detail section.
    Hmm...So. First off, I really appreciate your time and efforts and what you did truly helped. Secondly, I never did the one thing before as I did just moments ago and that was after i typed a few characters was pressing Enter. You may laugh, as you have every right. But before when I was using a list box, as I typed it narrowed the search. Not that it is needed but thats what I was expecting I guess.

    At any rate June7, bravo bravo, another one bites the dust! Thanks again!!

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    That doesn't explain why you were getting popup. Also, none of the suggestions I offered would have altered the issue.

    Anyway, glad it's working for you.

    If you want filter as you type, that is possible. http://allenbrowne.com/AppFindAsUType.html
    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
    cp1981 is offline Advanced Beginner
    Windows 7 64bit Office 365
    Join Date
    Jul 2014
    Location
    Northeast Missouri
    Posts
    33
    Quote Originally Posted by June7 View Post
    That doesn't explain why you were getting popup. Also, none of the suggestions I offered would have altered the issue.

    Anyway, glad it's working for you.

    If you want filter as you type, that is possible. http://allenbrowne.com/AppFindAsUType.html
    From my understanding, the "like" syntax causes the pop up because the search box is empty so there obviously is a parameter missing. It's very possible that everything I posted originally actually worked, I just wasn't pressing "enter" after.

    I was just confused, not the fact that I was getting a pop-up, but that the syntax worked when I entered a parameter or a partial parameter in the pop up but wouldn't work (as I had thought it would) within the form.
    But I did take all of your advice, so nothing you did was in vain.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    So you were opening the query object? Why when the purpose is to filter form?
    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.

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

Similar Threads

  1. Replies: 8
    Last Post: 04-21-2021, 09:44 AM
  2. Replies: 4
    Last Post: 04-12-2019, 09:47 AM
  3. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  4. Replies: 3
    Last Post: 05-14-2015, 02:13 AM
  5. Replies: 8
    Last Post: 07-15-2014, 05:56 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