Re: Performing calcs on form values in the immediate window
From: Marshall Barton (marshbarton_at_wowway.com)
Date: 03/31/04
- Next message: Marshall Barton: "Re: Error Message Problem"
- Previous message: mark: "printing a form through vba"
- In reply to: Patti: "Re: Performing calcs on form values in the immediate window"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 31 Mar 2004 11:27:11 -0600
I'm not familar with that error message.
You definitely have to fully qualify all the terms though:
?DateDiff("n", Forms![Data Entry Form].[Start Time],
Forms![Data Entry Form].[End Time])
If you have a references issue, DateDiff itself may not be
available. Try something simple:
?DateDiff("n", #10:00#, #10:45#)
--
Marsh
MVP [MS Access]
Patti wrote:
>I tried it again, with:
> ? DateDiff("n", Forms![Data Entry Form].[Start Time], [End Time])
>and got the message: Compile error: External Name not defined. The
>form/field names are correct....do I have to declare them somewhere?
>
>The form was open when I did this.
>
>
>"Marshall Barton" wrote
>> >In my underlying query, I am calculating the time using DateDiff, but I
>> >haven't been able to figure out how to use it in the immediate window.
>Is
>> >that possible? When I try:
>> >
>> >TimeSpan = DateDiff("n", [Start Time], [End Time])
>> >? TimeSpan
>> >
>> >.. it doesn't work. I tried to wrap it in with "forms("Data Entry
>> >Form").Controls etc..with no luck.
>>
>>
>> The Debug window is a different context from either a query
>> or a form's module.
>>
>> As long as the form is open, the full references should work
>> whether you use it in the DateDiff function or some other
>> way.
>>
>> DateDiff("n", Forms("Data Entry Form").Controls("Start
>> Time").Value, . . .
>>
>> Or a little less verbose:
>>
>> DateDiff("n", Forms![Data Entry Form].[Start Time], . . .
>> --
>> Marsh
>> MVP [MS Access]
>
- Next message: Marshall Barton: "Re: Error Message Problem"
- Previous message: mark: "printing a form through vba"
- In reply to: Patti: "Re: Performing calcs on form values in the immediate window"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|