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: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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
 
Join Date: Mar 2014
Posts: 579
Thanks: 0
Thanked 130 Times in 130 Posts
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.
__________________
To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.
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,321
Thanks: 13
Thanked 1,396 Times in 1,330 Posts
Pat Hartman is a glorious beacon of light Pat Hartman is a glorious beacon of light Pat Hartman is a glorious beacon of light Pat Hartman is a glorious beacon of light Pat Hartman is a glorious beacon of light Pat Hartman is a glorious beacon of light
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 02:50 AM.


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

Sponsored Links

How to advertise

Media Kit


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