Results 1 to 11 of 11
  1. #1
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199

    List 1 to list 2

    I have a task here which i need a great help, i will try to explain in most suitable way,
    Click image for larger version. 

Name:	Clipboard01.jpg 
Views:	24 
Size:	16.6 KB 
ID:	14374



    I have list 1 where date and count of a file sent date and count of entries for the date appears, i want when i double click on item it should go to list 2 and disappears from list 1. and on clicking ok it should open form with file detailed entries from list 2. I think thats the simple way i could explain.

  2. #2
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199
    Bump!!!Bump!!!

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The 'moving' is not easy. Why do you need to? It isn't really necessary to 'move' items to other list just to open a form or report filtered to the selected item(s). Make list1 multi-select.

    Regardless, the same code is involved to build filter criteria from items in a listbox. http://allenbrowne.com/ser-50.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.

  4. #4
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Did something similar a while back.

    I have 2 list like you did. I have a Yes/No or True/False column which control the list display. On the list event "Double Click", you turn on and off the Yes/No or True/False column. Then refresh the form or query (forgot which one). The list one can be just display what is No/False and the list 2 can be just the Yes/True. Or you can have 2 tables. One contain list 1 and insert the record to list 2 on "Double Click". Either way should work.

    Hope this will help you on your way.

  5. #5
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    What is the listbox based on, Values or Table/query ?

  6. #6
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199
    Quote Originally Posted by amrut View Post
    What is the listbox based on, Values or Table/query ?
    Its on table/query

  7. #7
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199
    Quote Originally Posted by June7 View Post
    The 'moving' is not easy. Why do you need to? It isn't really necessary to 'move' items to other list just to open a form or report filtered to the selected item(s). Make list1 multi-select.

    Regardless, the same code is involved to build filter criteria from items in a listbox. http://allenbrowne.com/ser-50.html
    This is a great help, also intrested in either wasy of doing it.

  8. #8
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    You will need to loop through the selected listbox items and build a SQL which will be the rowsource of listbox.

  9. #9
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    The listbox row source can be table or query (its your choice). I used query based on a table.

    Something like this.

    MainTable:
    SDATE Date --> Primary Key
    CTRNO Number
    INCLUDED Yes/No

    qry_ListBox1:
    SELECT MainTable.SDATE, MainTable.CTRNO, MainTable.INCLUDED
    FROM MainTable
    WHERE (((MainTable.INCLUDED)=No))
    ORDER BY MainTable.SDATE;

    qry_ListBox2:
    SELECT MainTable.SDATE, MainTable.CTRNO, MainTable.INCLUDED
    FROM MainTable
    WHERE (((MainTable.INCLUDED)=Yes))
    ORDER BY MainTable.SDATE;

    ListBox1 "Row Source":
    SELECT [qry_ListBox1].[SDATE], [qry_ListBox1].[CTRNO] FROM qry_ListBox1 ORDER BY [SDATE];

    ListBox2 "Row Source":
    SELECT qry_ListBox2.SDATE, qry_ListBox2.CTRNO FROM qry_ListBox2 ORDER BY qry_ListBox2.[SDATE];

    ListBox1 "Double Click":
    Private Sub ListBox1_DblClick(Cancel As Integer)
    Dim mySQL As String
    Stop
    ' MsgBox "SDATE = (" & ListBox1.Column(0) & ", " & ListBox1.Column(1) & ")"
    mySQL = "UPDATE MAINTABLE SET INCLUDED = Yes "
    mySQL = mySQL & "WHERE SDATE = #" & ListBox1.Column(0) & "#"
    DoCmd.SetWarnings False
    DoCmd.RunSQL (mySQL)
    DoCmd.SetWarnings True
    Me.Refresh
    End Sub

    ListBox2 "Double Click":

    Private Sub ListBox2_DblClick(Cancel As Integer)
    Dim mySQL As String
    ' MsgBox "SDATE = (" & ListBox2.Column(0) & ", " & ListBox2.Column(1) & ")"
    mySQL = "UPDATE MAINTABLE SET INCLUDED = No "
    mySQL = mySQL & "WHERE SDATE = #" & ListBox2.Column(0) & "#"
    DoCmd.SetWarnings False
    DoCmd.RunSQL (mySQL)
    DoCmd.SetWarnings True
    Me.Refresh
    End Sub

    This is one way of doing it.

  10. #10
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Here is another site that give two examples for doing this:

    http://www.tek-tips.com/faqs.cfm?fid=6326


    Linq ;0)>

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

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

Similar Threads

  1. Replies: 4
    Last Post: 09-20-2013, 03:20 PM
  2. Replies: 13
    Last Post: 09-07-2013, 04:57 PM
  3. Replies: 1
    Last Post: 11-23-2012, 10:26 PM
  4. Replies: 2
    Last Post: 04-05-2012, 08:39 PM
  5. Replies: 4
    Last Post: 06-16-2011, 09:30 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