Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-13-2018, 09:43 AM   #1
vagues0ul
Newly Registered User
 
Join Date: Sep 2018
Posts: 103
Thanks: 18
Thanked 2 Times in 1 Post
vagues0ul is on a distinguished road
Automatically Update Textbox Value on Report Load

I am having issue while updating textbox value on report load. I want the textbox values to load automatically instead of clicking on it while the reports load because on click every box display its value to all the present box on the report.

this is my script

Private Sub Text148_Click()
Text148.Text = Round((m1totals.Value / markstotal.Value) * 100, 2)

End Sub


i dont want it to be done ONCLICK but on report load

vagues0ul is offline   Reply With Quote
Old 09-13-2018, 10:31 AM   #2
June7
Newly Registered User
 
June7's Avatar
 
Join Date: Mar 2014
Posts: 1,653
Thanks: 0
Thanked 405 Times in 402 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: Automatically Update Textbox Value on Report Load

Why using Text property? Probably really want to set Value but this cannot be done with textbox on report. Since Value is default, no need to type it.

If you are trying to save to table - why? Why don't you put expression in ControlSource and calculate when needed?

Really not clear what you are trying to accomplish.
__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
Old 09-13-2018, 12:22 PM   #3
Pat Hartman
Super Moderator
 
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 27,555
Thanks: 13
Thanked 1,453 Times in 1,385 Posts
Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all
Re: Automatically Update Textbox Value on Report Load

The Load property runs ONCE when the report is loaded. Your expression appears to depend on data from the report's RecordSource. That means that you want the code to run for each row so the Format event would be better.

Additional comments on syntax:

In Access forms/reports, the .value property is the default and the .text property is only available while the control has the focus so I can't imagine this working.

For efficiency, use Me.controlname rather than controlname.value

Me. is available ONLY in the code module of the form/report. It qualifies the variable so that Access knows where it is defined. It also provides intellisense. See what happens when you type:
Me.controlname.
you'll get a list of properties and methods

And finally, it is really poor practice to leave controls with the default name. BEFORE you add code to events or reference a control, always rename it so that it has a meaningful name. When you drag controls from the bound RecordSource, Access gives them the same name as the ControlSource. Common practice is to rename them with a prefix such as txt or cbo or cmd.

__________________
Bridge Players Still Know All the Tricks
Pat Hartman is offline   Reply With Quote
Reply

Tags
access report , onload , textbox.value

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update an unassigned textbox on load Locopete99 Modules & VBA 2 04-23-2018 08:04 AM
Automatically Print on load Report stu_c Macros 2 04-06-2017 08:41 AM
HELP! Automatically load a certain query as a filter? bduncan Modules & VBA 1 08-31-2009 06:21 AM
Assign value to report textbox on load lisarmj Reports 5 04-18-2007 01:50 PM
Automatically Load Switchboard Hysteria86 Macros 4 11-01-2006 02:53 PM




All times are GMT -8. The time now is 03:53 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World