Results 1 to 7 of 7
  1. #1
    RyanP is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    60

    Populate Unbound Fields on Report

    Attempting to populate unbound fields on a report. Seems like a no brainer?

    Report has no record source. The fields (1 combo and 2 text) are unbound. The combo has the appropriate control source / fields are formatted as they should be.

    Tried setting it via VBA from the command that opens the report. Blank
    Tried setting it via the Form Open or Load events. Blank

    Just for a test; I put a command button on the report and used all the same variables. The fields are then populated!

    (The Control sources of the other fields are being applied fine)


    'Open the Report
    DoCmd.OpenReport stDocName, acViewReport, , , acHidden

    'Populate the Report
    'Report Range
    [Reports]![rptReportName].Report![txtReportStartDate].Value = [Forms]![frmMAIN]![sfrmReportConfigurator].[Form].txtFLTRStartDate
    [Reports]![rptReportName.Report![txtReportEndDate].Value = [Forms]![frmMAIN]![sfrmReportConfigurator].[Form].txtFLTREndDate

    'Department

    If [Forms]![frmMAIN]![sfrmReportConfigurator].[Form]!optFLTR_Dept.Value = 1 Then
    [Reports]![rptReportName].Report.[cbo_Dept].Value = 7
    [Reports]![rptReportName].Report.COUNTFIELD.ControlSource = "=" & DCount("*", "QUERYNAME")
    else if
    [Reports]![rptReportName].Report.[cbo_Dept].Value = 7 = [Forms]![frmMAIN]![sfrmReportConfigurator].Form.[cboFLTR_Dept]
    [Reports]![rptReportName].Report.COUNTFIELD.ControlSource = "=" & DCount("*", "OTHERQUERYNAME")

  2. #2
    RyanP is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    60
    Was not setting the values using Open Arguments as there was an IF statement involved...

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Why is it UNBOUND if you want to populate them?
    Just bind them to fields.

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Why is it UNBOUND if you want to populate them?
    Just bind them to fields.
    I agree. That is a bit odd. I have never heard of an "Unbound Report" before (a Report with no Record Source).

  5. #5
    RyanP is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    60
    The report is essentially a container for 8 fields (counts of query results) and 8 subforms (displaying those results).

    So the main report is really just a container (with a header).

    All the DCOUNT fields and the subforms load properly (using the criteria from the form), however I cannot get the criteria from the form copied over to the report header.

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    however I cannot get the criteria from the form copied over to the report header.
    Create a one-record Table to store your Criteria.
    You can then use this table as the Record Source of your Report, and you will have that Criteria available to you to put on your Report.

  7. #7
    RyanP is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    60
    thx JoeM. Roundabout of accomplishing this but it works.
    added a table with only the report header fields. created a single record to store the values.
    Before opening the report, DoCmd.RunSQL to copy the Report Header info (date range, department etc) from the form to the table using an update query. Then load the report meanwhile setting the control sources for all the count fields / populatung the subforms based on the report config info from the form. voila

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

Similar Threads

  1. Replies: 5
    Last Post: 11-27-2012, 03:56 AM
  2. Replies: 8
    Last Post: 08-02-2012, 10:50 AM
  3. populate unbound field
    By DCV0204 in forum Access
    Replies: 3
    Last Post: 03-16-2012, 02:41 PM
  4. Replies: 5
    Last Post: 06-22-2011, 08:47 PM
  5. Populate unbound listbox with VBA
    By usmcgrunt in forum Forms
    Replies: 1
    Last Post: 09-23-2010, 09:11 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