Give a value to an unbound text box on an access 2007 report at runtime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrzebo1
    New Member
    • Jul 2007
    • 8

    Give a value to an unbound text box on an access 2007 report at runtime

    I have an access 2007 report that I an executing from a form, The report is based on a query that i change when it is execuded using me.recordsource =, There is a text box in the heading that i want to give a value to when the report is executed. The following line of vba code is what i tried but i get an error stateing "the control can't be referenced unless it has focus". when i try to set focus i get the error "ms office doesn't allow you to use this method in current view".

    [Report_Associat e Location By Site-AM].txtLocation.Se tFocus

    [Report_Associat e Location By Site-AM].txtLocation.Te xt = Form_Reporting. cmbLocation.Val ue
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Unlike straight Visual Basic, in VBA the Text property is seldom used because the control has to have focus at the time, as the error indicated, and you can't set focus to a control in a report! Use the Value property instead.

    Linq ;0)>

    Comment

    Working...