A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Extending a Date



 
 
Thread Tools Display Modes
  #1  
Old November 6th, 2006, 10:10 PM posted to microsoft.public.access.queries
Nanette
external usenet poster
 
Posts: 151
Default Extending a Date

I'm trying to extend a date which is based on a dated in one field and a
number of weeks in another field.

When I entered this:
=ExtendedDate:[DateEntered]+[InternalLTW]*[7]

I was told that I entered an operand without an operator.

Since the InternalLTW is in weeks, I added the multiplication of 7.

How should this work?
  #2  
Old November 7th, 2006, 12:35 AM posted to microsoft.public.access.queries
John Vinson
external usenet poster
 
Posts: 4,033
Default Extending a Date

On Mon, 6 Nov 2006 14:10:04 -0800, Nanette
wrote:

I'm trying to extend a date which is based on a dated in one field and a
number of weeks in another field.

When I entered this:
=ExtendedDate:[DateEntered]+[InternalLTW]*[7]

I was told that I entered an operand without an operator.

Since the InternalLTW is in weeks, I added the multiplication of 7.

How should this work?


YOu're multiplying by whatever value is in the field NAMED [7].

If you want to add InternalLTW weeks to the date, I'd suggest

ExtendedDate: DateAdd("ww", [InternalLTW], [DateEntered])

or

ExtendedDate: DateAdd("D", 7 * [InternalLTW], [DateEntered])


John W. Vinson[MVP]
  #3  
Old November 7th, 2006, 12:35 AM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Extending a Date

Nanette wrote:

I'm trying to extend a date which is based on a dated in one field and a
number of weeks in another field.

When I entered this:
=ExtendedDate:[DateEntered]+[InternalLTW]*[7]

I was told that I entered an operand without an operator.

Since the InternalLTW is in weeks, I added the multiplication of 7.



Except for the extraneous = at the beginning, it should
work. However, it depends on how a date field is handeled
internally, Better would be :

ExtendedDate: DateAdd("ww", [InternalLTW], DateEntered)

Note that [InternalLTW] is a really ugly name for a field.

--
Marsh
MVP [MS Access]
  #4  
Old November 7th, 2006, 01:27 AM posted to microsoft.public.access.queries
Nanette
external usenet poster
 
Posts: 151
Default Extending a Date

Hi Marshall,

I tried your suggestion and the other one from John and now I am getting
#Name!

I am putting this formula in the Control Source of a text label in a form.
Is this correct place to put it or should it go into the table?

Thanks for the hint about the ugly name. It means Internal Lead Time in
Weeks. Being new at naming, would ILTW be better?

"Marshall Barton" wrote:

Nanette wrote:

I'm trying to extend a date which is based on a dated in one field and a
number of weeks in another field.

When I entered this:
=ExtendedDate:[DateEntered]+[InternalLTW]*[7]

I was told that I entered an operand without an operator.

Since the InternalLTW is in weeks, I added the multiplication of 7.



Except for the extraneous = at the beginning, it should
work. However, it depends on how a date field is handeled
internally, Better would be :

ExtendedDate: DateAdd("ww", [InternalLTW], DateEntered)

Note that [InternalLTW] is a really ugly name for a field.

--
Marsh
MVP [MS Access]

  #5  
Old November 7th, 2006, 06:39 AM posted to microsoft.public.access.queries
John Vinson
external usenet poster
 
Posts: 4,033
Default Extending a Date

On Mon, 6 Nov 2006 17:27:01 -0800, Nanette
wrote:

I am putting this formula in the Control Source of a text label in a form.
Is this correct place to put it or should it go into the table?


It certainly cannot and should not go into a query.

You can put a calculated expression a couple of places. One would be
to put it into a vacant Field cell in a Query, in which case you
precede the expression with a new fieldname, ending with a colon:

ExtendedDate: DateAdd("ww", [InternalLTW], [DateEntered])

Or, you can put it into the Control Source of a Form or Report
textbox, in which case you do NOT use a fieldname, but use an equals
sign instead:

=DateAdd("ww", [InternalLTW], [DateEntered])


John W. Vinson[MVP]
  #6  
Old November 7th, 2006, 07:52 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Extending a Date

You can use whatever name makes sense to you and any other
folks that might have to modify your application. My point
was directed more at the use of the period in the name.
Best practice is to avoid using anything except alphanumeric
characters. ILTW would be a very short name or
InternalLeadTimeWeeks if you don't mind long names or
something in between.

You get a #Name error when Access can not find an item name
used in the expression. In this case you have two names,
[InternalLTW] and DateEntered, one of which is undefined or
maybe just misspelled. The names must be the name of
another control (text box, etc) on the form or the name of a
field in the form's record source table/query.
--
Marsh
MVP [MS Access]


Nanette wrote:
I tried your suggestion and the other one from John and now I am getting
#Name!

I am putting this formula in the Control Source of a text label in a form.
Is this correct place to put it or should it go into the table?

Thanks for the hint about the ugly name. It means Internal Lead Time in
Weeks. Being new at naming, would ILTW be better?

"Marshall Barton" wrote:

Nanette wrote:

I'm trying to extend a date which is based on a dated in one field and a
number of weeks in another field.

When I entered this:
=ExtendedDate:[DateEntered]+[InternalLTW]*[7]

I was told that I entered an operand without an operator.

Since the InternalLTW is in weeks, I added the multiplication of 7.



Except for the extraneous = at the beginning, it should
work. However, it depends on how a date field is handeled
internally, Better would be :

ExtendedDate: DateAdd("ww", [InternalLTW], DateEntered)

Note that [InternalLTW] is a really ugly name for a field.

  #7  
Old November 7th, 2006, 10:06 PM posted to microsoft.public.access.queries
Nanette
external usenet poster
 
Posts: 151
Default Extending a Date

Thanks to the both of you Marshall and John.

I have my date extending working and appreicated the additional suggestions.

Nanette

"Marshall Barton" wrote:

You can use whatever name makes sense to you and any other
folks that might have to modify your application. My point
was directed more at the use of the period in the name.
Best practice is to avoid using anything except alphanumeric
characters. ILTW would be a very short name or
InternalLeadTimeWeeks if you don't mind long names or
something in between.

You get a #Name error when Access can not find an item name
used in the expression. In this case you have two names,
[InternalLTW] and DateEntered, one of which is undefined or
maybe just misspelled. The names must be the name of
another control (text box, etc) on the form or the name of a
field in the form's record source table/query.
--
Marsh
MVP [MS Access]


Nanette wrote:
I tried your suggestion and the other one from John and now I am getting
#Name!

I am putting this formula in the Control Source of a text label in a form.
Is this correct place to put it or should it go into the table?

Thanks for the hint about the ugly name. It means Internal Lead Time in
Weeks. Being new at naming, would ILTW be better?

"Marshall Barton" wrote:

Nanette wrote:

I'm trying to extend a date which is based on a dated in one field and a
number of weeks in another field.

When I entered this:
=ExtendedDate:[DateEntered]+[InternalLTW]*[7]

I was told that I entered an operand without an operator.

Since the InternalLTW is in weeks, I added the multiplication of 7.


Except for the extraneous = at the beginning, it should
work. However, it depends on how a date field is handeled
internally, Better would be :

ExtendedDate: DateAdd("ww", [InternalLTW], DateEntered)

Note that [InternalLTW] is a really ugly name for a field.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.