Compare record field to current time for visibility

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am not sure how to do this but would like to display a field in a report
beside the records that will be coming due within five minutes of the current
time. I have the report refreshing every 60 seconds. I was trying to place
something into the Control Source of a TextBox with a default property of
"Visible = No" like:

=IIf(-5 > DateDiff("n", [DueTime], Time())),Null,Visible = True

but I get the error "The expression you entered has a function containing
the wrong number of arguments". Could someone please help?

Greatly appreciated! Terri
 
Terri said:
I am not sure how to do this but would like to display a field in a report
beside the records that will be coming due within five minutes of the current
time. I have the report refreshing every 60 seconds. I was trying to place
something into the Control Source of a TextBox with a default property of
"Visible = No" like:

=IIf(-5 > DateDiff("n", [DueTime], Time())),Null,Visible = True

but I get the error "The expression you entered has a function containing
the wrong number of arguments". Could someone please help?


You can not easily set control properties ny using a control
source expression. Instead use code in the detail section's
Format event:

Me.thetextbox.Visible = (DateDiff("n", [DueTime], Time) < 5)
 
Thanks for your reply Marshall but I am not able to make it work. I have
added a field to the query that the report uses to calculate the minutes per
record and I have been trying to make the field visible if >=5 but I am still
having trouble. I have tried to add different lines to the Detail_Format
routine, like below, but it seems to be ignored. What am I doing wrong?
Thanks!

If Me.Minutes >=5 Then
Visible = True
End If


Marshall Barton said:
Terri said:
I am not sure how to do this but would like to display a field in a report
beside the records that will be coming due within five minutes of the current
time. I have the report refreshing every 60 seconds. I was trying to place
something into the Control Source of a TextBox with a default property of
"Visible = No" like:

=IIf(-5 > DateDiff("n", [DueTime], Time())),Null,Visible = True

but I get the error "The expression you entered has a function containing
the wrong number of arguments". Could someone please help?


You can not easily set control properties ny using a control
source expression. Instead use code in the detail section's
Format event:

Me.thetextbox.Visible = (DateDiff("n", [DueTime], Time) < 5)
 
Nevermind the last post. Between your advice and some other posts I was able
to play around and get it working. Thank you for the help!

Terri said:
Thanks for your reply Marshall but I am not able to make it work. I have
added a field to the query that the report uses to calculate the minutes per
record and I have been trying to make the field visible if >=5 but I am still
having trouble. I have tried to add different lines to the Detail_Format
routine, like below, but it seems to be ignored. What am I doing wrong?
Thanks!

If Me.Minutes >=5 Then
Visible = True
End If


Marshall Barton said:
Terri said:
I am not sure how to do this but would like to display a field in a report
beside the records that will be coming due within five minutes of the current
time. I have the report refreshing every 60 seconds. I was trying to place
something into the Control Source of a TextBox with a default property of
"Visible = No" like:

=IIf(-5 > DateDiff("n", [DueTime], Time())),Null,Visible = True

but I get the error "The expression you entered has a function containing
the wrong number of arguments". Could someone please help?


You can not easily set control properties ny using a control
source expression. Instead use code in the detail section's
Format event:

Me.thetextbox.Visible = (DateDiff("n", [DueTime], Time) < 5)
 
Back
Top