Results 1 to 6 of 6
  1. #1
    Rev12 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    11

    How to cascade listboxes and export selection?

    Dear All,

    I have already 3 listboxes in my form 1st to display all my queries 2nd display all field names after selection from the 1st lisbox, 3rd is to display the field name to export.

    Can anyone is kind to share a link or threads or a sample relevant to this kind of scenario?

    I had attached a snapshot to have a clear idea of what I am trying to do.



    Click image for larger version. 

Name:	Untitled.png 
Views:	19 
Size:	54.4 KB 
ID:	34719
    Any kind of help is much appreciated.

    Thanks in advance,
    Rev12

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Normally ,the listbox shows data,but to show fields,you'd need vb.
    the code would scan the table clicked,
    Cycle thru the fields,posting them to a table,
    the listbox show this table.
    or
    have all the fields for each table IN a table (as data)
    Then a query can show in the fields instantly.
    the only code would be:
    Code:
    sub lstBox1_afterupdate()
    lstBox2.requery
    end sub

  3. #3
    Rev12 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    11
    Quote Originally Posted by ranman256 View Post
    but to show fields,you'd need vb.
    the code would scan the table clicked,
    Cycle thru the fields,posting them to a table,
    the listbox show this table.
    or
    have all the fields for each table IN a table (as data)
    Then a query can show in the listbox instantly.
    the only code would be:
    Code:
    sub lstBox1_afterupdate()
    lstBox2.requery
    end sub
    please if you can share with me the code or sample threads or link to have all this work, will you?

    I am trying to look around any similar threads by still no luck??

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    the EASIEST, is put the tables/fields in a table: tLists
    tbl,fld
    rate, RateID
    rate, Amt
    rate, Note
    client, clientID
    client, FirstN
    client, LastN

    listbox 1 would be a query on the field : table
    select distinct [tbl] from tLists

    listbox 2 query would pull the FIELDS filtered on TABLE:
    select [FLD] from tLists where [tbl] = forms!myForm!listBox1

    the only code needed is the listbox1_Afterupdate event to refresh listbox2 when user picks listbox1

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    If you want to pull field names from table or query object, set the RowSourceType property to FieldList then code can set RowSource to name of table or query selected in the first listbox.

    I have a db with feature like this. Allows users to select fields to export but I modify a query object and export that, not a 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.

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Can you have a look at the attached file and see if that is what you're after?

    Cheers,
    Vlad
    Attached Files Attached Files

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

Similar Threads

  1. Replies: 3
    Last Post: 08-20-2017, 02:58 PM
  2. Replies: 18
    Last Post: 07-01-2016, 02:52 PM
  3. Connected Listboxes
    By brc in forum Queries
    Replies: 2
    Last Post: 07-08-2011, 09:22 AM
  4. how to edit listboxes?
    By RedGoneWILD in forum Programming
    Replies: 2
    Last Post: 08-23-2010, 11:53 AM
  5. dropdowns and listboxes
    By t_dot in forum Forms
    Replies: 6
    Last Post: 08-19-2010, 11:12 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