Assign a table field value to a variable in subreport vba RRS feed

  • Question

  • Hello,

    In my MS Access database, I have a report object named 'ReportA' and this report contains a subreport named 'ReportB'.

    The Control Source of the subreport 'ReportB' is 'TableB'.

    The 'TableB' has a field named 'TelephoneNumber'.

    In the On Format event (VBA) of the detail area of the subreport 'ReportB', I want to assign the 'TelephoneNumber' field value of the current record to the variable named 'VariableA'.

    I have tried:

    Dim VariableA

    VariableA = [TelephoneNumber]   'Didn't work, I don't know why because this code works on non-SUBreport

    VariableA = Me.[TelephoneNumber] 'Also didn't work

    VariableA = Me.TelephoneNumber 'Also didn't work

    Can someone please give me the correct code?

    Thank you,

    Wednesday, May 22, 2013 5:20 AM