N
Nathan C. Lee
We're using Access '97 for this. I need to change the color of several text
fields in a report.
1) My first question has to do with referencing the fields themselves. I
have 16 different fields, but for simplicity, I'm using a variable
"fieldBeingChanged" to reference them, and using a Select Case operation to
select which field is being referenced. E.g.
....
Dim fieldBeingChanged As String
....
Case TRR
fieldBeingChanged = "Report!StatusReport!TRRField"
Is this the correct way to refer to the field? I'm a little unsure about
when to use quotes and when not.
2) In the same Select Case, I need to reference two dates, valuePlan and
valueActual. The values in the database's table sometimes contain spaces,
for instance, the value is held as "TRR Plan". The code looks like this:
Dim valuePlan As Date
Dim valueActual As Date
....
Select Case currentPlace
....
Case TRR
....
valuePlan = "Table!tblToolDatasheet!TRR Plan"
valueActual = "Table!tblToolDatasheet!TRR Actual"
I think I need quotes here, because the compiler yells at me because of the
white space. Is this the correct way? It tells me that "Table" is
undefined... so how am I supposed to get something out of a table?
3) Finally, how should I actually change the color? I've tried
fieldBeingChanged.BackColor = vbGreen
but that's not working at all. The compiler highlights "fieldBeingChanged"
and says "Invalid Qualifier". I'm guessing it thinks I'm trying to change
the BackColor on the string, but I really want to do it on the field the
string is referencing.
Thank you in advance for your time.
fields in a report.
1) My first question has to do with referencing the fields themselves. I
have 16 different fields, but for simplicity, I'm using a variable
"fieldBeingChanged" to reference them, and using a Select Case operation to
select which field is being referenced. E.g.
....
Dim fieldBeingChanged As String
....
Case TRR
fieldBeingChanged = "Report!StatusReport!TRRField"
Is this the correct way to refer to the field? I'm a little unsure about
when to use quotes and when not.
2) In the same Select Case, I need to reference two dates, valuePlan and
valueActual. The values in the database's table sometimes contain spaces,
for instance, the value is held as "TRR Plan". The code looks like this:
Dim valuePlan As Date
Dim valueActual As Date
....
Select Case currentPlace
....
Case TRR
....
valuePlan = "Table!tblToolDatasheet!TRR Plan"
valueActual = "Table!tblToolDatasheet!TRR Actual"
I think I need quotes here, because the compiler yells at me because of the
white space. Is this the correct way? It tells me that "Table" is
undefined... so how am I supposed to get something out of a table?
3) Finally, how should I actually change the color? I've tried
fieldBeingChanged.BackColor = vbGreen
but that's not working at all. The compiler highlights "fieldBeingChanged"
and says "Invalid Qualifier". I'm guessing it thinks I'm trying to change
the BackColor on the string, but I really want to do it on the field the
string is referencing.
Thank you in advance for your time.