Re: Performing calcs on form values in the immediate window

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Marshall Barton (marshbarton_at_wowway.com)
Date: 03/31/04


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]
>


Relevant Pages

  • Re: Changing alignment of * commands in toc?
    ... references section, which in books is often not numbered), be aligned ... Each toc entry comes in two parts, ... since we need to change the sectional commands. ...
    (comp.text.tex)
  • Re: required fields
    ... If you attempt to close the form while some required fields are left blank, ... entry before closing. ... Cancel = True ... error message if they try to close the form without entering all required ...
    (microsoft.public.access.forms)
  • Re: required fields
    ... to prevent Access saving the record if the field is null. ... entry before closing. ... Cancel = True ... error message if they try to close the form without entering all required ...
    (microsoft.public.access.forms)
  • Re: error 3078:
    ... I made those changes but I still receive the same error message ... "Stuart McCall" wrote: ... Set db = CurrentDb ... ' Compute change from entry week scores & put into tables ...
    (microsoft.public.access.modulesdaovba)
  • Re: Changing alignment of * commands in toc?
    ... references section, which in books is often not numbered), be aligned ... Each toc entry comes in two parts, ... since we need to change the sectional commands. ... toc entry is aligned with the section number). ...
    (comp.text.tex)