Referencing Form Objects From A Different Form or Report
Frequently it is necessary to reference the data in a form from either a different form or report. The example below shows the syntax for this type of reference. The example references text boxes, a date control and a label.
Program Code
Option Compare Database Option Explicit Private Sub Form_Load() If CurrentProject.AllForms("frmFreightAP_InvoicePosting").IsLoaded Then Me.lblVendorName.Caption = [Forms]![frmFreightAP_InvoicePosting]![lblVendorName].Caption Me.lblHeaderComment.Caption = "Header Comment: " & [Forms]![frmFreightAP_InvoicePosting]![txtHeaderComment] Me.lblEnteredBy.Caption = [Forms]![frmFreightAP_InvoicePosting]![txtEnteredBy] Me.lblVendorNo.Caption = "Vendor#: " & [Forms]![frmFreightAP_InvoicePosting]![txtVendorNo] Me.lblInvoiceNo.Caption = "Invoice#: " & [Forms]![frmFreightAP_InvoicePosting]![txtInvoiceNo] Me.lblInvoiceDate.Caption = "Invoice Date: " & [Forms]![frmFreightAP_InvoicePosting]![dteInvoiceDate] Me.lblActualDate.Caption = "Actual Date: " & [Forms]![frmFreightAP_InvoicePosting]![dteActualDate] End If End Sub