Thanks Andy and Holly.
I tried the txDate=Date again and it still returns the Run-Time error of
94: 'Invalid use of Null.' So I started over with a fresh form and it
worked fine.
I went back to the original form and played with it until I discovered that
the problem arises when I bind a record source (table or query) to the form.
It does not seem to matter whether the txtDate *control*" is bound or not;
only when the *form* has a record source defined will the error occur.
I've distilled this problem down to its essence by creating a form with
only a single textbox control and the following code:
Option Compare Database
Option Explicit
Dim x
Private Sub Form_Load()
txtDate = Date
x = txtDate
MsgBox x 'test value of x
End Sub
This works works fine, right up until I bind a recordsource to the form. As
I mentioned, I can have txtDate bound or unbound and the error persists.
Why would binding a recordsource to a form cause an 'invalid use of Null'
error with the Date function? To make matters more confusing, if I
substitute the Now function for the Date function, it WILL work.
One final point of confusion, when I type the Date function in my form
module I include the parens (e.g., 'Date()'). However, the intellisense
feature automatically removes them from the Date function. It does not
remove them from the Now function.
Sorry to sound like such a novice. But I have checked the online help,
Getz's A97 HB, and Balter's MA95 and I cannot find anything on point.
Usually when the problem is this frustrating, it's something really stupid.
If anyone could enlighten me I would be very grateful.
Thanks,
Dave