conditional formatting using a variable

L

laavista

I am using Access 2007 and want to use the "conditional formatting" for a
field on a form.

My field is called "CancelByDate". I want the field to turn pink when the
CancelByDate is within a certain timeframe, e.g., if CancelByDate is
<= 30 days. It works well when I hard-code the number of days:
expression is: [CancelByDate]<=Date()+30

The user, though, is going to be setting the number of days they wish for
the reminder, so I want to use a variable instead.
expression is: [CancelByDate]<=Date()+ intReminders_NumberOfDays

Access changes the variable to a string and puts quotes around the variable,
e.g.,
expression is: [CancelByDate]<=Date()+"intReminders_NumberOfDays"
and it doesn't work.

Any suggestions?

(I want to thank everyone in the forum. I have learned so much by reading
the questions & responses.)
 
G

GBA

presuming the day count provided by user is in the same open form then you
would use:

Me.[intReminders_NumberOfDays]

in intReminders is the name of your form then:

Me.NumberOfDays

not clear from your post....
 
L

laavista

Thanks for the response.

I should have provided more info in my post.

The variable I want to use is a global variable as it is used in multiple
places throughout the application.

Do you know how a global variable would be used?

Thanks.

GBA said:
presuming the day count provided by user is in the same open form then you
would use:

Me.[intReminders_NumberOfDays]

in intReminders is the name of your form then:

Me.NumberOfDays

not clear from your post....

laavista said:
I am using Access 2007 and want to use the "conditional formatting" for a
field on a form.

My field is called "CancelByDate". I want the field to turn pink when the
CancelByDate is within a certain timeframe, e.g., if CancelByDate is
<= 30 days. It works well when I hard-code the number of days:
expression is: [CancelByDate]<=Date()+30

The user, though, is going to be setting the number of days they wish for
the reminder, so I want to use a variable instead.
expression is: [CancelByDate]<=Date()+ intReminders_NumberOfDays

Access changes the variable to a string and puts quotes around the variable,
e.g.,
expression is: [CancelByDate]<=Date()+"intReminders_NumberOfDays"
and it doesn't work.

Any suggestions?

(I want to thank everyone in the forum. I have learned so much by reading
the questions & responses.)
 

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