Results 1 to 12 of 12
  1. #1
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20

    Filling unbound listbox with data from query in continiuous form

    For the purpose of learning Access I want to create a small Access application to keep track of electronic components. My current design and the corresponding continuous from looks like this:



    Click image for larger version. 

Name:	component_db.png 
Views:	21 
Size:	30.4 KB 
ID:	21592

    Click image for larger version. 

Name:	component_db_form.png 
Views:	20 
Size:	62.1 KB 
ID:	21591


    Now to my issue: I want to populate the content of the unbound listbox at the very right of the form either through a query or through VBA code. I already have a working query that uses the component ID (there is a component ID field on the form that is hidden to the user) and returns the corresponding SupplierName with the corresponding Link and Price of the component.
    My problem is that all listboxes on the continuous form show the exact same content. It seems like the query is only run once when the continuous form loads and then all listboxes use this data. But what I need is that the query is run for each individual form of the continuous form. How do I do that?

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    If the listbox is unbound, it will the same for each row. Rather than using a listbox, use a subform

  3. #3
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20
    A subform cannot be used within a continuous form. Any other solutions?

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    What Ajax is saying and what you already have discovered is that you cannot use the listbox in a continuous form the way you would like to. An alternative would be to put the listbox in the form's header or footer. I am not sure how I would go about this. I do not use contiguous forms very often. For what you are doing, a continuous form may not be the best solution.

    As I try to imagine various scenarios, I hit a hurdle. A user could select a single record/item from the continuous form and trigger an event. In turn, a single list of vendors could be presented to the user (maybe in the form's Header/Footer). An alternative may be to use a Report. Reports are useful when it comes to Grouping things like this.

  5. #5
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20
    I would prefer not to have such a listbox or anything with this functionality in the header/footer.

    How would you build this form without using a continuous form? The reason why I am currently using a continuous form is because the user can enter any value into the text box and there are most likely multiple results, not just one. Using a continuous form the users sees all components on first glance. When it is a single form the user has to go through the components using the record selectors or other navigation buttons that are part of the form itself.
    Any ideas?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Maybe this alternative will meet your needs http://www.fmsinc.com/MicrosoftAcces...edSubforms.asp

    Nope, just took another look at OP. Don't think that approach will accomplish.
    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
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I'm confused - you say it is an unbound control but you also say 'The reason why I am currently using a continuous form is because the user can enter any value into the text box'. If this is the case, the control needs to be bound.

    I was going to suggest you could modify Allen Browne's solution here

    http://allenbrowne.com/ser-42.html

    basically replace the comma separator with vbcrlf and call it in your form recordsource and bind a textbox to it, but the result will not be editable

  8. #8
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20
    Quote Originally Posted by Ajax View Post
    I'm confused - you say it is an unbound control but you also say 'The reason why I am currently using a continuous form is because the user can enter any value into the text box'. If this is the case, the control needs to be bound.
    I was referring to the search text box, sorry.

    I assume that having a form where a search term can be entered and a query will return multiple results is a very common case. How are the search results usually presented to the user? You mentioned that the continuous form is probably not the best solution for my problem anyway but what other options are there? Should the search results just fill a list and a form opens upon clicking a list entry?
    The reason why I like(d) the continuous form solution is because the users gets presented with all the information about the components that were found during the search - in a neat form with easy and fast navigation by simply scrolling.


    Quote Originally Posted by Ajax View Post
    I was going to suggest you could modify Allen Browne's solution here

    http://allenbrowne.com/ser-42.html
    I am not sure whether I understand how this helps in my case. How is using DLookUp() or the suggested ELookUp() different from running a real query?

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Maybe you better consider a report. Report opened in Report View can be interactive.
    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.

  10. #10
    Tectu is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    20
    Thank you for your suggestion. I will take a look at that. So far I have not touched reports at all. I thought their only purpose is to generate printable documents.
    Good that this is a project to learn without any deadline

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Reports are intended for data manipulation and output (printing) but can be interactive (scrolling, clicking) with Report View (not Print Preview).

    Forms are intended for data entry and screen display but can be printed.
    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.

  12. #12
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    How are the search results usually presented to the user?
    depends on the purpose of the results, number of fields etc. but for data entry it is usually single form - suggest review the split form option (I presume it is available in 2013)

    How is using DLookUp() or the suggested ELookUp() different from running a real query?
    I was suggesting ELookup, not DLookup. It can be called from a query and the result bound textbox which is currently unbound (the one that has test1, test, test3 in it

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

Similar Threads

  1. Using unbound form data in query not working
    By Perceptus in forum Queries
    Replies: 4
    Last Post: 10-21-2014, 08:00 AM
  2. Replies: 5
    Last Post: 06-23-2014, 03:32 PM
  3. Replies: 5
    Last Post: 02-12-2014, 11:52 PM
  4. Replies: 7
    Last Post: 01-22-2013, 09:44 PM
  5. Replies: 1
    Last Post: 11-28-2012, 04:14 PM

Tags for this Thread

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