Convert expression to code

K

Kirstie Adam

Hi All,

I have a conditional formatting expression i would like to convert to code,
and need some help!

I want the code to be in the OnOpen event of a report (called
rptAllInformation).

If the value of [DIA FORM ISSUED] is more than 6 weeks ago, and [DIA
RESPONSE RECEIVED] is null, then label (lblOverdueWarning) becomes visible

At the moment the expresson is:

[DIA RESPONSE RECEIVED] Is Null And [DIA FORM ISSUED]<DateAdd("w",-6,Date())

Can anyone help?

Kirstie
 
M

Marshall Barton

Kirstie Adam said:
Hi All,

I have a conditional formatting expression i would like to convert to code,
and need some help!

I want the code to be in the OnOpen event of a report (called
rptAllInformation).

If the value of [DIA FORM ISSUED] is more than 6 weeks ago, and [DIA
RESPONSE RECEIVED] is null, then label (lblOverdueWarning) becomes visible

At the moment the expresson is:

[DIA RESPONSE RECEIVED] Is Null And [DIA FORM ISSUED]<DateAdd("w",-6,Date())


lblOverdueWarning.Visible = [DIA RESPONSE RECEIVED] Is Null
And [DIA FORM ISSUED]<DateAdd("w",-6,Date())
 
K

Kirstie Adam

Hi Marshall,

I can't get it to work.

I put that into code, but only get the debugger window up.

Here is what i put

Private Sub Report_Open(Cancel As Integer)
lblOverdueWarning.Visible = [DIA RESPONSE RECEIVED] Is Null And [DIA FORM
ISSUED] < DateAdd("w", -6, Date)
End Sub

Have i done something wrong? Should i make it an IF statement?

Kirstie

Marshall Barton said:
Kirstie Adam said:
Hi All,

I have a conditional formatting expression i would like to convert to
code,
and need some help!

I want the code to be in the OnOpen event of a report (called
rptAllInformation).

If the value of [DIA FORM ISSUED] is more than 6 weeks ago, and [DIA
RESPONSE RECEIVED] is null, then label (lblOverdueWarning) becomes visible

At the moment the expresson is:

[DIA RESPONSE RECEIVED] Is Null And [DIA FORM
ISSUED]<DateAdd("w",-6,Date())


lblOverdueWarning.Visible = [DIA RESPONSE RECEIVED] Is Null
And [DIA FORM ISSUED]<DateAdd("w",-6,Date())
 
M

Marshall Barton

What error message did you get?

I believe that you need to put that code in an event that
occurs later than the Open event because the data fields are
loaded after the Open event. If you need to make it
visible/invisible for each record, then you need to put the
line of code in the detail section's Format event. (The
report header section's Format event could be used if you
want to make it visible for all records based on the field
values in the first record.)
--
Marsh
MVP [MS Access]


Kirstie Adam said:
I put that into code, but only get the debugger window up.

Private Sub Report_Open(Cancel As Integer)
lblOverdueWarning.Visible = [DIA RESPONSE RECEIVED] Is Null And [DIA FORM
ISSUED] < DateAdd("w", -6, Date)
End Sub

Have i done something wrong? Should i make it an IF statement?


lblOverdueWarning.Visible = [DIA RESPONSE RECEIVED] Is Null
And [DIA FORM ISSUED]<DateAdd("w",-6,Date())
Kirstie Adam said:
I have a conditional formatting expression i would like to convert to
code,
and need some help!

I want the code to be in the OnOpen event of a report (called
rptAllInformation).

If the value of [DIA FORM ISSUED] is more than 6 weeks ago, and [DIA
RESPONSE RECEIVED] is null, then label (lblOverdueWarning) becomes visible

At the moment the expresson is:

[DIA RESPONSE RECEIVED] Is Null And [DIA FORM
ISSUED]<DateAdd("w",-6,Date())
 

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