Results 1 to 3 of 3
  1. #1
    Steve in Lubbock is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    2

    Need Field Data from specific records in subreport in textbox of parent report

    I am trying to create a report where the work order id number as listed in a sub-report can be used as column headings in the parent report for a blank daily report. I would like to have up to five text boxes where the first one gets the value from record one of the sub-report, the second text box gets the value from record 2, etc. etc.


    If anyone has suggestions of how to do this please let me know.

    Steve

  2. #2
    knarfreppep is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Location
    Adelaide, Australia
    Posts
    106
    Quote Originally Posted by Steve in Lubbock View Post
    I am trying to create a report where the work order id number as listed in a sub-report can be used as column headings in the parent report for a blank daily report. I would like to have up to five text boxes where the first one gets the value from record one of the sub-report, the second text box gets the value from record 2, etc. etc.
    If anyone has suggestions of how to do this please let me know.

    Steve
    Can't begin to imagine why you would want to do this but try this.

    I'm assuming 5 text boxes accross the top of your main form and 5 or more rows in your subform.

    In the 1st text box set the ControlSource to =int_gfctHeading(1) ... in the 2nd =int_gfctHeading(2) ... etc.

    Create a global function -

    Public Function int_gfctHeading(ByVal bytRow as Byte)

    Dim rsRecordset as Recordset
    Dim bytCounter as Byte

    Set rsRecordset = Codedb.OpenRecordset("SELECT TOP 5 * FROM tblSubformTable", dbOpenSnapshot)

    For bytCounter = 1 to bytRow -1
    Recordset.MoveNext
    Next

    int_gfctHeading = rsRecordset!intWorkOrder

    Set rsRecordset = Nothing

    End Function

    Hopefully you will need a WHERE clause in the recordset SQL to get the subset of records where the FK = the PK on your main form.

  3. #3
    Steve in Lubbock is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    2
    Thank you knarfreppep. I will give this a try.

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

Similar Threads

  1. Replies: 20
    Last Post: 05-19-2015, 05:10 AM
  2. subreport link to parent report
    By markjkubicki in forum Reports
    Replies: 2
    Last Post: 07-26-2013, 07:35 AM
  3. Replies: 1
    Last Post: 04-04-2013, 11:59 AM
  4. Subreport will not show specific data
    By mitchy1111 in forum Reports
    Replies: 1
    Last Post: 05-18-2011, 07:36 AM
  5. Replies: 3
    Last Post: 06-23-2010, 02:02 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