Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when trying to Assign a value to a textbox in a report

Status
Not open for further replies.

cwassel

MIS
Oct 12, 2004
4
US
I am trying to assign a value to a textbox in the footer of my report. I am trying to assign a global variable to the textbox, to display in the footer. Here is some sample code where i try to hard code a value into a textbox.

txtHours.SetFocus
txtHours.Text = "43"

However, when I try to program this code withoutusing the SetFocus statement, I receive an error that says "you cannot reference a property or method for a control that doesn't have the focus". However once I set the focus using code I receive this error, "Microsoft access does not allow you to use this method in the current view". I am trying to put my code in the Open event of the form. Does anyone know why I receive these errors. Also, is there any way to assign a value to a textbox in an Access report? Thank you for your time and help
 
Try using the (default) .value property (without setting focus)

[tt]me!txtHours.value = 43 ' or just
me!txtHours= 42[/tt]

Also, perhaps do the assigning in the on format event of the section (footer)

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top