Results 1 to 7 of 7
  1. #1
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110

    Transfer form listbox data to Report listbox.

    Hi Guys,

    I'm stuck in somewhere in the report.
    I want to copy exactly the form listbox data to the report listbox. Any idea?
    In the report listbox, i try to link it to from form listbox =[Forms]![QMS]![roi]
    But it still doesn't show up the data.



    Click image for larger version. 

Name:	report2.JPG 
Views:	13 
Size:	48.7 KB 
ID:	30670Click image for larger version. 

Name:	report.JPG 
Views:	12 
Size:	87.4 KB 
ID:	30671

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    your report listbox will need the same valuelist or rowsource as used in your form.

    If your report is opened from the form, you could pass this as an openarg for docmd.openreport, then in your report, have some code in the open event to populate your listbox from the openarg

  3. #3
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    Quote Originally Posted by Ajax View Post
    your report listbox will need the same valuelist or rowsource as used in your form.

    If your report is opened from the form, you could pass this as an openarg for docmd.openreport, then in your report, have some code in the open event to populate your listbox from the openarg
    Hi Ajax,

    Thanks for replying. I want to pass the form listbox data to report listbox because i need to print it out.
    I'm not sure whether valuelist or rowsourse i should choose.

    I thought if i put in REPORT listbox = [Forms]![QMS]![roi] , report listbox should copy all the data from FORM listbox?

    Click image for larger version. 

Name:	report3.JPG 
Views:	11 
Size:	95.9 KB 
ID:	30676

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    No, all that does is pull the value of single selected item. If nothing is selected or the listbox is multi-select then second listbox can't pull anything and will be Null. Regardless, if the second listbox has no RowSource then it has no data to display.

    RowSource determines items in the list, the expression you used is in ControlSource.

    Be aware listbox does not have CanGrow or CanShrink properties. It will have to be sized for the longest possible list of items you can expect to be returned by the RowSource. Consider using subreports instead.
    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
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    your rowsource type is either valuelist or table/query. If it is a valuelist, the rowsource will be something like '0ne;three;elephant;zoo'. If aquery it will be something like 'SELECT ID, Name from myTable'

  6. #6
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    Quote Originally Posted by June7 View Post
    No, all that does is pull the value of single selected item. If nothing is selected or the listbox is multi-select then second listbox can't pull anything and will be Null. Regardless, if the second listbox has no RowSource then it has no data to display.

    RowSource determines items in the list, the expression you used is in ControlSource.

    Be aware listbox does not have CanGrow or CanShrink properties. It will have to be sized for the longest possible list of items you can expect to be returned by the RowSource. Consider using subreports instead.
    Hi June / Ajax,

    I'm beginner on Access. Need some time to learn more on this.
    Please look at the attachment. The problem i actually faced is i couldn't fit the QMS into 1 form.
    I'm fine to make it 2 pages when export to PDF file. But the title and header must be the same.
    Attachment is what i get and i need to improve it. Any alternative way to improve it?
    This is From the form direct export to PDF.

    1234 Record2.pdf

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    If info needs to be repeated on each page then put it in Page Header or Footer section. Label controls for the fields could be in Header 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.

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

Similar Threads

  1. Transfer records from listbox 1 to listbox 2 gone wrong
    By Pommetje77 in forum Programming
    Replies: 6
    Last Post: 11-08-2016, 04:36 AM
  2. Replies: 4
    Last Post: 02-02-2015, 07:47 PM
  3. Replies: 1
    Last Post: 01-31-2015, 09:03 PM
  4. Replies: 7
    Last Post: 06-05-2012, 03:22 PM
  5. Replies: 1
    Last Post: 12-18-2011, 01:09 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