Not sure what to do with this error
Try this:
If Nz(Me!CommtExpireDateZ, 0) = Now() Then
If CommtExpireDateZ is null, it will return a 0 which should return
Commitment has EXPIRED. If you would rather see Commitment Expiration when
there is a null, change the 0 above to 100000. That should for for a few
decades.
Try the thing with the form without the NZ function. It would not be needed
there.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
"Mike" wrote:
Jerry,
Thanks for the thorough response. I tried your first suggestion and it
returned the current date.
I'm trying to figure out the Nz command, but am getting a compile error, so
I'm sure it's more than putting Nz in front of that line, but I googled it,
and didn't know where to go next with this part: (sorry, I've not done this
before at all)
Private Sub Form_Current()
Nz If Me!CommtExpireDateZ = Now() Then
Me![CommtLabel] = "Commitment has EXPIRED!"
Else
Me![CommtLabel] = "Commitment Expiration:"
End If
End Sub
Also, I tried to do your suggestion about with the form open and on a record
to type in your suggestion, but got a different error and wasn't sure if the
Nz function from above had to be working yet. I get this (not sure if I am
doing this right either):
Runtime Error :2450. It says it can't find the form referred to. I'm
inputting the form listed in the left hand upper pane of the debug window
called Form_ClientDataForm. There are 3 other forms listed, and I haven't
tried them all, but I think this one is the one. Again, not sure if I am
doing this right.
If you have any further advice, I would appreciate it. Again, I haven't
done this before and I"m sure I'm messing it up in some way.
Mike
"Jerry Whittle" wrote:
With the database open press Ctrl + g. In the Immediate window type this and
press Enter:
Debug.Print Now()
You should get the current date and time. If not you probably have a
reference problem.
If Me!CommtExpireDateZ is null, this could cause a problem as it can't be
evaluated against Now(). You might want to wrap it in the NZ function.
Next with the form open and on a record, type something like the following
in the Immediate window the hit enter:
Debug.Print Forms![TheFormsName]![CommtExpireDateZ]
Make sure to insert the correct form name. It should return the data
displayed in that field. If not, there's a problem.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
"Mike" wrote:
Folks,
I"m trying to figure out what to do with an error we are getting, and I
don't know what I'm looking at unfortunately. We had a employee who created
a glorified mail merg with access 2003. He has since left the company. We
have users wanting to use the program, and we are getting an error, and I
don't know how to fix it. Have not done any access programming myself.
Users are getting a Run-Time Error 2683 - There is no object in this
control. A quick google search mentions registering mscomctl2.ocx, but that
doesn't seem to make the error go away.
When I hit debug, I get this:
'This code causes the Commitment Expiration date text box--which i am using
as label
'to change based on a comparison of todays date and the date in the
DatePicker for
'the commitment expiration date.
Private Sub Form_Current()
If Me!CommtExpireDateZ = Now() Then
Me![CommtLabel] = "Commitment has EXPIRED!"
Else
Me![CommtLabel] = "Commitment Expiration:"
End If
End Sub
The "If Me!CommtExpireDateZ =Now() Then line is hightlighted in the debug
screen.
I have no idea what to do to fix this, any advice from the experts here?
Thanks,
Mike
|