By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,471 Members | 2,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,471 IT Pros & Developers. It's quick & easy.

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

P: 8
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_Associate Location By Site-AM].txtLocation.SetFocus

[Report_Associate Location By Site-AM].txtLocation.Text = Form_Reporting.cmbLocation.Value
Apr 9 '10 #1

✓ answered by missinglinq

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)>

Share this Question
Share on Google+
1 Reply


missinglinq
Expert 2.5K+
P: 3,532
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)>
Apr 9 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.