Syntax Problem?

EternalMyrtle - How would Access know to which control I am assigning a name?


Clearly I don't fully understand what you are trying to do so I am giving up.


Good luck :D
 
Can I ask why you want to do this in the manner you are trying?
Have you considered things like using a Tag to identify all of the controls you want to do something with? Then looking fo Controls where the tag is XXX, then change Backcolor or whatever?
 
Your code should work but it doesn't. So that means something else is going on. Try with another name for your variable. Also, put Option Explicit at the top of the module and compile: code windoww->Debug->compile
 
Try this:

Dim ctrl as Control

Set ctrl = Me.Date1 ‘Replace Date1, with name of your control

ctrl.Properties("backcolor") = 8454143
 
I got my original code to work. The reason it was failing was because I did not correctly name all 90 controls. The names should have been Date1, Date2, Date3...etc.
It turned out that Date48 was named Text80 so when my code tried to change the backcolor of Date48 I got the "Data member not found" error.
Thanks to all for your help!!
 
So the code you supplied at the beginning wasn't the actual code failing? Ohh geeee .. what a lot of fun. Not!

Next time, make no assumptions, no shortcuts, no interpretations but show THE ACTUAL code & values.
 
'***This works
Me.Controls("Date1").BackColor = "8454143"
TS
I wanted to see what color 8454143 was so I applied to one of my forms. When I saved it, I changed to #FFFF80. What is there that I need to learn about colors?
 
8454143 is just the RGB conversion for #FFFF80 - it's the same thing you get if you use RGB(255, 255, 128).

To be technical, from what I can tell, the RGB function swaps the first two characters with the last two characters of the hex string, then converts it to decimal and viola.
 
Spikepl - I posted an abbreviated version of the code - the part that was failing. That code was actually within a loop in which I checked each record in a recordset to determine whether the date was a work day. I explained the concept to Simon in my post of 2/25 3:31 PM. I thought I was simplifying things by providing the concept and a snippet of code. From now on I will follow your advise and post the complete code. I hope you didn't spend too much time on this. I apologize if you did. Many thanks for your help.
 

Users who are viewing this thread

Back
Top Bottom