Set Control value on a form

D

Duane Hookom

Forms!frmYourForm!txtYourControl.Value = "Some Value"
The form must be open and txtYourControl must be updateable.
 
M

MeSteve

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.
 
D

Duane Hookom

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.
 
M

MeSteve

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.
 
D

Duane Hookom

I would write or call the code from the On Format event of the report section
that contains the control.
 
M

MeSteve

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?
 
D

Duane Hookom

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top