From: poorboy13 via AccessMonster.com on
Thanks to all who responded - I appreciate it.
I did look through the References list in the VBA editor and could not find
anything that was "Missing".
I should mention I do have 2 other forms in the same DB with almost identical
code (with the exception of the actual field names) that work just fine.
Instead of BODDate = Date
It is StartDate = Date
and EndDate = Date
These work just fine.
But the form with BODDate = Date does not work.

I do find it odd that VBA looses the () and both Access and Excel (maybe Word
too I don't know) use Date() instead of Date. I have tried stuffing Date into
a formated variable and making BODDate = the variable, but it does the same
thing.

Any other suggestions?

I have back ups at various stages in the design, so I may just scrap it and
go back and redo this part but it is just somewhat baffling to say the least.



Linq Adams wrote:
>I agree with Fred, this is a fairly common problem and almost always a case
>of a missing reference, and the VBA Editor will, indeed, strip the trailing
>parens.
>

--
Message posted via http://www.accessmonster.com

From: Stuart McCall on
"BruceM via AccessMonster.com" <u54429(a)uwe> wrote in message
news:a7e640215bef6(a)uwe...
> In addition to what has been suggested, look at the top of the code
> module.
> If Option Explicit does not appear below Option Compare Database, add it,
> then compile the code. If you had to add it, in the VBA editor go to
> Tools
>>> Options, click the Editor tab, and check Require Variable Declaration.
> This is how to go about it in Access 2003. I'm not sure how it would be
> done
> in later versions.
>
> If you are adding values programatically I don't think there is a need to
> unlock the controls. Also, I would add the Me. prefix:
>
> Me.BODDate = Date
>
> When you use the prefix, Access will look for BODDate only in the form's
> properties (which includes fields and controls). Without the prefix
> Access
> needs to resolve whether BODDate is a field, function, constant, variable,
> property, or whatever. Also, the Me prefix followed by a dot presents you
> with a pick list, which often saves time, and tends to reduce the
> possibility
> of typos.

And when the object prefix (Me) is used, its memory address can be resolved
at compile-time, instead of at run-time, when it could slow things down.
Disambiguation is a Good Thing for all sorts of reasons.


From: BruceM via AccessMonster.com on
What happens when you add Option Explicit and compile the code? Also, try
adding the Me prefix to BODDate, at least. I would name the control
something like txtBODDate to distinguish it from the field name. I doubt it
is the problem, but if you can resolve some of the ambiguities it may help
you sort out what is happening.

Assuming the code compiles, try placing a break point into the code. When
the code breaks, go to the immediate window and type:
?Date()
and press Enter.

poorboy13 wrote:
>Thanks to all who responded - I appreciate it.
>I did look through the References list in the VBA editor and could not find
>anything that was "Missing".
>I should mention I do have 2 other forms in the same DB with almost identical
>code (with the exception of the actual field names) that work just fine.
>Instead of BODDate = Date
>It is StartDate = Date
>and EndDate = Date
>These work just fine.
>But the form with BODDate = Date does not work.
>
>I do find it odd that VBA looses the () and both Access and Excel (maybe Word
>too I don't know) use Date() instead of Date. I have tried stuffing Date into
>a formated variable and making BODDate = the variable, but it does the same
>thing.
>
>Any other suggestions?
>
>I have back ups at various stages in the design, so I may just scrap it and
>go back and redo this part but it is just somewhat baffling to say the least.
>
>>I agree with Fred, this is a fairly common problem and almost always a case
>>of a missing reference, and the VBA Editor will, indeed, strip the trailing
>>parens.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1

From: poorboy13 via AccessMonster.com on
Nothing. I tried the Option Explicit and compile and it shows no errors.
I added the Me.Prefix and changed the Control name. It still gives off the
same error.

With the break point, in the Immediate Window I get an Run-time error '2465'
and the same message of "...can not find the field 'Date' referred to in your
expression."

Thanks for your help!


BruceM wrote:
>What happens when you add Option Explicit and compile the code? Also, try
>adding the Me prefix to BODDate, at least. I would name the control
>something like txtBODDate to distinguish it from the field name. I doubt it
>is the problem, but if you can resolve some of the ambiguities it may help
>you sort out what is happening.
>
>Assuming the code compiles, try placing a break point into the code. When
>the code breaks, go to the immediate window and type:
>?Date()
>and press Enter.
>
>>Thanks to all who responded - I appreciate it.
>>I did look through the References list in the VBA editor and could not find
>[quoted text clipped - 20 lines]
>>>of a missing reference, and the VBA Editor will, indeed, strip the trailing
>>>parens.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1

From: BruceM via AccessMonster.com on
Please post the line of code at which the error occurs.

poorboy13 wrote:
>Nothing. I tried the Option Explicit and compile and it shows no errors.
>I added the Me.Prefix and changed the Control name. It still gives off the
>same error.
>
>With the break point, in the Immediate Window I get an Run-time error '2465'
>and the same message of "...can not find the field 'Date' referred to in your
>expression."
>
>Thanks for your help!
>
>>What happens when you add Option Explicit and compile the code? Also, try
>>adding the Me prefix to BODDate, at least. I would name the control
>[quoted text clipped - 12 lines]
>>>>of a missing reference, and the VBA Editor will, indeed, strip the trailing
>>>>parens.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1