Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    Ally1205 is offline Advanced Beginner
    Windows 7 64bit Access 2000
    Join Date
    Jul 2013
    Posts
    68
    Quote Originally Posted by June7 View Post
    The parameterized query is a saved Access query object? The listbox RowSource is referencing the query object? Then the listbox RowSource just needs to be: SELECT * FROM SearchQ;
    June7 ...Thank you! This works. However, can you (or someone) tell me how I get the listbox to update whenever I run the query? As it stands, I have to switch the form to design view and then back to form view, to get the listbox to update itself to the query results based on the search string I have entered one of the text boxes on the form.

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Try clicking the Refresh button from menu bar or write code behind form to requery the listbox. The trick is figuring out what event to put code in. Not necessary to 'run the query' and does not refresh the form or controls on it anyway. Why are you using a listbox instead of binding form to the query?
    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. #18
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Me.ListboxName.Requery

    I am glad June chimed in. I should have thought to have you post the RowSource of the listbox.

  4. #19
    Ally1205 is offline Advanced Beginner
    Windows 7 64bit Access 2000
    Join Date
    Jul 2013
    Posts
    68
    Quote Originally Posted by June7 View Post
    Try clicking the Refresh button from menu bar or write code behind form to requery the listbox. The trick is figuring out what event to put code in. Not necessary to 'run the query' and does not refresh the form or controls on it anyway. Why are you using a listbox instead of binding form to the query?
    Thank you for your help. I couldn't find a refresh button in my menu bar....

    Here is what I want to do: I have set up some text boxes to show the fields of the current record. To select the current record, I want to click on one of the records in a list of search query results. I want to run the search query based on whatever I type into one or all of four search text boxes on my form. They are called SrchFirstName, SrchLastName, SrchCity and SrchState. I want to get the search results to appear in a list where I can select one as the current record which then appears in my form. It don't particularly care how the search results list is displayed (list box, sub-form, or whatever), as long as I can click on one of the records so that it becomes the current record showing in the main area of the form, which has textboxes to display all the fields of that record.

    With regards to binding the form to a query... It is currently bound to the same query I am using to search for records. I hope that is the right thing to do. I need the list box (or sub-form query results) so that if my search string finds several records that fit the search criteria, I can see all those records and select the one I'm looking for.

    Thank you..
    Ally1205

  5. #20
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    I don't know A2000, but would expect Refresh to be on some menu.

    However, making a main form and subform synchronize like a split form might be difficult. This means both main form and subform need to have the same RecordSource and the subform container control Master/Child links properties cannot be set. Code behind subform needs to apply additional filter to the main form based on the ID of specific record selected in subform but want the subform to still show all records that meet the criteria of the 4 search boxes. That means code in some event of the subform to set the main form Filter and FilterOn properties, maybe the subform DblClick event.
    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.

  6. #21
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    In A2000 Refresh is in "Views" or you can use F5
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #22
    Ally1205 is offline Advanced Beginner
    Windows 7 64bit Access 2000
    Join Date
    Jul 2013
    Posts
    68
    Quote Originally Posted by Bob Fitz View Post
    In A2000 Refresh is in "Views" or you can use F5
    It's not in mine, (Ver. 9.0.2720). Pressing F5 had no effect either.
    Regards,
    Ally1205

  8. #23
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Did you try code suggestion in my previous post?
    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. #24
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    edit: didn't see 2nd page

  10. #25
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    in the on click event of the list box use

    me.requery

    to update the contents of the list box you'd have to have something like an ON EXIT event for each one of your search field:

    lst_Name.requery

  11. #26
    Ally1205 is offline Advanced Beginner
    Windows 7 64bit Access 2000
    Join Date
    Jul 2013
    Posts
    68
    Quote Originally Posted by June7 View Post
    I don't know A2000, but would expect Refresh to be on some menu.

    However, making a main form and subform synchronize like a split form might be difficult. This means both main form and subform need to have the same RecordSource and the subform container control Master/Child links properties cannot be set. Code behind subform needs to apply additional filter to the main form based on the ID of specific record selected in subform but want the subform to still show all records that meet the criteria of the 4 search boxes. That means code in some event of the subform to set the main form Filter and FilterOn properties, maybe the subform DblClick event.
    Thanks for the continued advice. So it looks as though using a listbox is the best way to display the search results then. I just wish I could figure out what code to add, and where, so that the list updates when text is entered into the search boxes and so that when I click on a record in the listbox, that record shows in my form as the current record.

    This YouTube video shows a similar idea which would work for me:
    http://www.youtube.com/watch?v=3cJinHSSkuI
    ...but I could not get his code to work when I tried to reproduce his application. As soon as I type a character into the txtProperty box,
    It throws up a syntax error, with the following line of code highlighted:
    .Text & "*' " _ & "Or OrderNumber Like '*" & Me.txtProperty.Text & "*' " Me.lstSearchResults.RowSource = strSource

  12. #27
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    use the ON EXIT property of your search boxes to requery the list box.

    the way it functions be this: a user types in a string, when they hit ENTER or TAB to get away from the current search field the list box will be updated.

    If you are trying to have the list box update on each character typed I would recommend against that, it's basically issuing a requery for every character typed which isn't terribly efficient, but it's definitely flashier if that's what you're going after.

  13. #28
    Ally1205 is offline Advanced Beginner
    Windows 7 64bit Access 2000
    Join Date
    Jul 2013
    Posts
    68
    Thanks, everyone for the help. I now have figured out how to achieve what I want, using a combo box.
    Ally1205

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 13
    Last Post: 01-30-2013, 03:05 PM
  2. Automating "Append" Query with Parameters
    By Monterey_Manzer in forum Queries
    Replies: 1
    Last Post: 10-04-2012, 12:00 PM
  3. Access 2003 "Link Text Wizard" bug
    By spacekowboy in forum Import/Export Data
    Replies: 2
    Last Post: 05-30-2012, 02:28 PM
  4. Using InfoPath under "Create Email" wizard
    By Alex in forum Import/Export Data
    Replies: 0
    Last Post: 07-21-2010, 07:30 AM
  5. How to Filter When Using The "Create E-Mail" Wizard
    By MFriend in forum Import/Export Data
    Replies: 3
    Last Post: 07-16-2010, 09:45 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
  •  
Other Forums: Microsoft Office Forums