What is "23/06/3000"? It appears to be the European date format for June
23rd, 3000, altought I can't imagine why you need to track a date 1000 years
in the future, so I'm guessing it's something else (then again, maybe you're
trying to calculate when they will have all the bugs fixed in Windows Vista).
It could be that Access can't determine what it is, and therefore can't tell
if [text233] is less than or equal to it, so [text239] defaults to the
alternate choice in your IIf statement, which is null. Hence, you end up with
an expression that has no value. To test this, you could change it to:
=IIf([text233]<="23/06/3000",[text233]+7,0)
This will give it an alternate value of zero. Then see if your error message
goes away. If it does, then you know you're probably on the right track.
If "23/06/3000" does represent a date, then you might want to verify that
all of the fields you are using for your calculation are of the Date/Time
data type.
HTH
BTW - If you plan on working with Access much in the future, you should give
your fields more descriptive names. Months or years from know, you might
regret that your code is full of references like [text233] and [text239].
You'll spend a lot of extra time determining which controls they refer to.
Just a suggestion.
Roger Bell said:
The IIf statement in [text239] is as follows:
=IIf([text233]<="23/06/3000",[text233]+7,Null)
Thanks again
Beetle said:
In your first post you indicated that you were trying to use the IIf
statement to control the visibility of your text box. If that's the case,
just get rid of the IIf statement and use the code to control the visibility.
If that's not the case, and your IIf statement serves some other necessary
purpose, then post your exact IIf here and maybe myself or someone else can
help you solve your current problem.
Roger Bell said:
Thanks for that Beetle.
I have created an OnLoad Event procedure as follows:
Private Sub Report_Open(Cancel As Integer)
If Me.Text239 <= "23/06/3000" Then
Me.W53.Visible = True
Else
Me.W53.Visible = False
End If
End Sub
When I open the report I receive a 2427 error "You entered an expression
that has no value"
The problem appears to be that the [Text239] has an IIf Statement in the
control source. Is there any way around this?
Thanks again
:
You can add some code in the On Current event of your form or report to
accomplish what you want. Something like;
If Me.FieldName = 0 Then
Me.FieldName.Visible = False
Else
Me.FieldName.Visible = True
End If
HTH
:
I have a field on a report that is formatted for currency and displays zero
dollars as the default.
What I would like is for the field to be NOT visible if it is zero and
visible if the amount exceeds zero.
The control source would need to use the IIf command. Whether it is to be
visible or not will depend on another field. EG:
IIf([Date]>0,Visible,NotVisible) Is there a code that will activate Visible
or Not Visible?
Thanks for any help