On Format event procedure

G

Guest

I am trying to create a report that will visually display between 1 and 4
boxes for each record of a report. My recordset contains values for
Event1_in, Event1_Out, Event1_Action, ... Event4_Action.

I currently have code that will alter the left, width, and backcolor of each
of the action controls based on the values in the In, Out, and Action text
boxes. However, I am currently doing this by referring to each of the
controls using

me.Event1_Action.Left = xxx
me.Event1_Action.width = yyy
me.Event1_Action.Backcolor = zzz
....
me.Event4_Action.Backcolor = zzz

I would prefer to do this using a loop to loop through the controls but I
keep getting a "Object does not support this property or method" error (#438)
when I use the format:

me.controls("Event" & cstr(intEvent) & "_Action").left = xxx

Can anyone provide any other ideas that would allow me to put this in a loop
and avoid this error message? This is a test database, and eventually, I
expect to have up to 10 Events associated with each record.
 
M

Marshall Barton

Dale said:
I am trying to create a report that will visually display between 1 and 4
boxes for each record of a report. My recordset contains values for
Event1_in, Event1_Out, Event1_Action, ... Event4_Action.

I currently have code that will alter the left, width, and backcolor of each
of the action controls based on the values in the In, Out, and Action text
boxes. However, I am currently doing this by referring to each of the
controls using

me.Event1_Action.Left = xxx
me.Event1_Action.width = yyy
me.Event1_Action.Backcolor = zzz
...
me.Event4_Action.Backcolor = zzz

I would prefer to do this using a loop to loop through the controls but I
keep getting a "Object does not support this property or method" error (#438)
when I use the format:

me.controls("Event" & cstr(intEvent) & "_Action").left = xxx

Can anyone provide any other ideas that would allow me to put this in a loop
and avoid this error message? This is a test database, and eventually, I
expect to have up to 10 Events associated with each record.


The code you posted looks ok. Are you sure the code you're
trying to execute is identical. When posting code, you
should use Copy/Paste so we can see the code with the
problem.

Where is this code?

What about the loop? Maybe there is something else going on
that we can't see.
 
G

Guest

Marsh

Brain cramp. I was referring to the recordset field name to get the left
and width values but was trying to assign these values to field
"Event#_Action" rather than the text box "txt_Event#_Action".

Thanks.
 
M

Marshall Barton

Dale said:
Marsh

Brain cramp. I was referring to the recordset field name to get the left
and width values but was trying to assign these values to field
"Event#_Action" rather than the text box "txt_Event#_Action".


Been there. Done that. Got the bruises from smacking self
up side the head too ;-)
 

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