Set Control value on a form

What is the syntax to set the value of control on a form from VBA?
0
Utf
2/7/2008 8:39:01 PM
access.reports 4434 articles. 0 followers. Follow

7 Replies
465 Views

Similar Articles

[PageSpeed] 8

Forms!frmYourForm!txtYourControl.Value = "Some Value"
The form must be open and txtYourControl must be updateable.
-- 
Duane Hookom
Microsoft Access MVP


"MeSteve" wrote:

> What is the syntax to set the value of control on a form from VBA?
0
Utf
2/7/2008 9:37:03 PM
This is what I needed to move the logic to a module.  I had already started 
tinkering with that, but couldn't get the control on the report to update.  I 
will try this tomorrow, thanks.

"Duane Hookom" wrote:

> Forms!frmYourForm!txtYourControl.Value = "Some Value"
> The form must be open and txtYourControl must be updateable.
> -- 
> Duane Hookom
> Microsoft Access MVP
> 
> 
> "MeSteve" wrote:
> 
> > What is the syntax to set the value of control on a form from VBA?
0
Utf
2/8/2008 12:05:02 AM
I am a little confused since this is a report forum and your most recent 
reply states "control on the report to update" but your initial question 
included "set the value of control on a form".

It would help if you provided some context regarding what you are attempting 
to do.

-- 
Duane Hookom
Microsoft Access MVP


"MeSteve" wrote:

> This is what I needed to move the logic to a module.  I had already started 
> tinkering with that, but couldn't get the control on the report to update.  I 
> will try this tomorrow, thanks.
> 
> "Duane Hookom" wrote:
> 
> > Forms!frmYourForm!txtYourControl.Value = "Some Value"
> > The form must be open and txtYourControl must be updateable.
> > -- 
> > Duane Hookom
> > Microsoft Access MVP
> > 
> > 
> > "MeSteve" wrote:
> > 
> > > What is the syntax to set the value of control on a form from VBA?
0
Utf
2/8/2008 12:30:02 AM
Oops, good catch.  I am trying to calculate the value of a control on a 
REPORT using VBA instead of the 'too deeply nested' code posted in another 
thread.

"Duane Hookom" wrote:

> I am a little confused since this is a report forum and your most recent 
> reply states "control on the report to update" but your initial question 
> included "set the value of control on a form".
> 
> It would help if you provided some context regarding what you are attempting 
> to do.
> 
> -- 
> Duane Hookom
> Microsoft Access MVP
> 
> 
> "MeSteve" wrote:
> 
> > This is what I needed to move the logic to a module.  I had already started 
> > tinkering with that, but couldn't get the control on the report to update.  I 
> > will try this tomorrow, thanks.
> > 
> > "Duane Hookom" wrote:
> > 
> > > Forms!frmYourForm!txtYourControl.Value = "Some Value"
> > > The form must be open and txtYourControl must be updateable.
> > > -- 
> > > Duane Hookom
> > > Microsoft Access MVP
> > > 
> > > 
> > > "MeSteve" wrote:
> > > 
> > > > What is the syntax to set the value of control on a form from VBA?
0
Utf
2/8/2008 1:13:03 AM
I would write or call the code from the On Format event of the report section 
that contains the control.

-- 
Duane Hookom
Microsoft Access MVP


"MeSteve" wrote:

> Oops, good catch.  I am trying to calculate the value of a control on a 
> REPORT using VBA instead of the 'too deeply nested' code posted in another 
> thread.
> 
> "Duane Hookom" wrote:
> 
> > I am a little confused since this is a report forum and your most recent 
> > reply states "control on the report to update" but your initial question 
> > included "set the value of control on a form".
> > 
> > It would help if you provided some context regarding what you are attempting 
> > to do.
> > 
> > -- 
> > Duane Hookom
> > Microsoft Access MVP
> > 
> > 
> > "MeSteve" wrote:
> > 
> > > This is what I needed to move the logic to a module.  I had already started 
> > > tinkering with that, but couldn't get the control on the report to update.  I 
> > > will try this tomorrow, thanks.
> > > 
> > > "Duane Hookom" wrote:
> > > 
> > > > Forms!frmYourForm!txtYourControl.Value = "Some Value"
> > > > The form must be open and txtYourControl must be updateable.
> > > > -- 
> > > > Duane Hookom
> > > > Microsoft Access MVP
> > > > 
> > > > 
> > > > "MeSteve" wrote:
> > > > 
> > > > > What is the syntax to set the value of control on a form from VBA?
0
Utf
2/8/2008 1:38:02 AM
Thanks.  Yeah, using code was the only way I could get around the Error# 
showing up because there was no record that matched my 'query'.

Why OnFormat?

"Duane Hookom" wrote:

> I would write or call the code from the On Format event of the report section 
> that contains the control.
> 
> -- 
> Duane Hookom
> Microsoft Access MVP
> 
> 
> "MeSteve" wrote:
> 
> > Oops, good catch.  I am trying to calculate the value of a control on a 
> > REPORT using VBA instead of the 'too deeply nested' code posted in another 
> > thread.
> > 
> > "Duane Hookom" wrote:
> > 
> > > I am a little confused since this is a report forum and your most recent 
> > > reply states "control on the report to update" but your initial question 
> > > included "set the value of control on a form".
> > > 
> > > It would help if you provided some context regarding what you are attempting 
> > > to do.
> > > 
> > > -- 
> > > Duane Hookom
> > > Microsoft Access MVP
> > > 
> > > 
> > > "MeSteve" wrote:
> > > 
> > > > This is what I needed to move the logic to a module.  I had already started 
> > > > tinkering with that, but couldn't get the control on the report to update.  I 
> > > > will try this tomorrow, thanks.
> > > > 
> > > > "Duane Hookom" wrote:
> > > > 
> > > > > Forms!frmYourForm!txtYourControl.Value = "Some Value"
> > > > > The form must be open and txtYourControl must be updateable.
> > > > > -- 
> > > > > Duane Hookom
> > > > > Microsoft Access MVP
> > > > > 
> > > > > 
> > > > > "MeSteve" wrote:
> > > > > 
> > > > > > What is the syntax to set the value of control on a form from VBA?
0
Utf
2/8/2008 1:41:00 AM
You could try either the On Format or the On Print of the section. I'm not 
sure if the control would grow or shrink if you set the value in the On Print 
event.
-- 
Duane Hookom
Microsoft Access MVP


"MeSteve" wrote:

> Thanks.  Yeah, using code was the only way I could get around the Error# 
> showing up because there was no record that matched my 'query'.
> 
> Why OnFormat?
> 
> "Duane Hookom" wrote:
> 
> > I would write or call the code from the On Format event of the report section 
> > that contains the control.
> > 
> > -- 
> > Duane Hookom
> > Microsoft Access MVP
> > 
> > 
> > "MeSteve" wrote:
> > 
> > > Oops, good catch.  I am trying to calculate the value of a control on a 
> > > REPORT using VBA instead of the 'too deeply nested' code posted in another 
> > > thread.
> > > 
> > > "Duane Hookom" wrote:
> > > 
> > > > I am a little confused since this is a report forum and your most recent 
> > > > reply states "control on the report to update" but your initial question 
> > > > included "set the value of control on a form".
> > > > 
> > > > It would help if you provided some context regarding what you are attempting 
> > > > to do.
> > > > 
> > > > -- 
> > > > Duane Hookom
> > > > Microsoft Access MVP
> > > > 
> > > > 
> > > > "MeSteve" wrote:
> > > > 
> > > > > This is what I needed to move the logic to a module.  I had already started 
> > > > > tinkering with that, but couldn't get the control on the report to update.  I 
> > > > > will try this tomorrow, thanks.
> > > > > 
> > > > > "Duane Hookom" wrote:
> > > > > 
> > > > > > Forms!frmYourForm!txtYourControl.Value = "Some Value"
> > > > > > The form must be open and txtYourControl must be updateable.
> > > > > > -- 
> > > > > > Duane Hookom
> > > > > > Microsoft Access MVP
> > > > > > 
> > > > > > 
> > > > > > "MeSteve" wrote:
> > > > > > 
> > > > > > > What is the syntax to set the value of control on a form from VBA?
0
Utf
2/8/2008 1:48:00 AM
Reply:

Similar Artilces: