Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2012

    Unanswered: Binding a textbox in a report to query field

    Hello everyone,

    I am new to MS Access and i am using access 2007 for a report that outputs various fields based on the outcome of the query. I have no problem with that as i have used a report wizard and the various textboxes for the respective fields appear on the "details" section of the report. The challenge is, i want to display the totals of the displayed fields on the textboxes which i have manualy added (did not use wizard) on the "reportfooter" section.

    To be more concise, qryBatchProfile is a query that updates the report with the fields on the details section when a command button cmd_Preview is clicked. Then the second query, qryTotals is suposed to compute sums per field in qrybatchProfile and update the textboxes on the "reportfooter" section.

    Now, when i click the command button to preview the report i get a dialog that requires me to enter the parameter value of qryTotals before the report is displayed. I understand that i have to set the recordsouce of my report to the two queries but the data tab on the property sheet is blank.this is the my code.

    Private Sub cmdPreview_Click()
    On Error GoTo Err_cmdPreview_Click

    Dim stDocName As String
    stDocName = "qryBatchProfile"
    DoCmd.OpenQuery stDocName, , acEdit

    stDocName = "qryTotals"
    DoCmd.OpenQuery stDocName, , acEdit

    'Me.Text27.Value = DCount("B_T", "Sum Of Blend Target(kg)")
    stDocName = "rptProfileData"
    DoCmd.OpenReport stDocName, acPreview

    Exit Sub

    MsgBox Err.Description
    Resume Exit_cmdPreview_Click

    End Sub

  2. #2
    Join Date
    Jan 2012

    binding textbox

    thanks in advance. I've found my way. I used subreports.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts