I am trying to set an expiration date in my form. What it does is if
the classroom is Bumble Bears, then add 1 year to the field [Date].
If the classroom is Kool Kidz, then it needs to default to 9/1/? (?
being the year of the next 9/1). This is what I have so far. Can
anybody help. Thank you!
=Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
([ClassroomID]="Kool Kidz",9/1/2008))
|
|
0
|
|
|
|
Reply
|
debbiep
|
9/29/2007 5:48:49 PM |
|
You need to test the current date and determine if it's later than 1
September so that you can determine the correct year to show. So change your
expression to this:
=Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
[ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
(CLng(Format(Date(),"mmdd"))>901), 9, 1))
I note that you're using the word Date as the name of a field in your table.
It and many other words are reserved words in ACCESS and should not be used
for control names, field names, etc. Allen Browne (MVP) has a very
comprehensive list of reserved words at his website:
Problem names and reserved words in Access
http://www.allenbrowne.com/AppIssueBadWord.html
See these Knowledge Base articles for more information about reserved words
and characters that should not be used:
List of reserved words in Access 2002 and Access 2003
http://support.microsoft.com/default.aspx?scid=kb;en-us;286335
List of Microsoft Jet 4.0 reserved words
http://support.microsoft.com/?id=321266
Special characters that you must avoid when you work with Access
databases
http://support.microsoft.com/?id=826763
See this site for code that allows you to validate your names as not being
VBA keywords:
basIsValidIdent - Validate Names to Make Sure They Aren't VBA Keywords
http://www.trigeminal.com/lang/1033/codes.asp?ItemID=18#18
--
Ken Snell
<MS ACCESS MVP>
<debbiep@ywcaofjamestown.com> wrote in message
news:1191088129.660508.176560@g4g2000hsf.googlegroups.com...
>I am trying to set an expiration date in my form. What it does is if
> the classroom is Bumble Bears, then add 1 year to the field [Date].
> If the classroom is Kool Kidz, then it needs to default to 9/1/? (?
> being the year of the next 9/1). This is what I have so far. Can
> anybody help. Thank you!
>
> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> ([ClassroomID]="Kool Kidz",9/1/2008))
>
|
|
0
|
|
|
|
Reply
|
Ken
|
9/29/2007 8:02:46 PM
|
|
On Sep 29, 4:02 pm, "Ken Snell \(MVP\)"
<kthsneisll...@ncoomcastt.renaetl> wrote:
> You need to test the current date and determine if it's later than 1
> September so that you can determine the correct year to show. So change your
> expression to this:
>
> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> [ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
> (CLng(Format(Date(),"mmdd"))>901), 9, 1))
>
> I note that you're using the word Date as the name of a field in your table.
> It and many other words are reserved words in ACCESS and should not be used
> for control names, field names, etc. Allen Browne (MVP) has a very
> comprehensive list of reserved words at his website:
>
> Problem names and reserved words in Accesshttp://www.allenbrowne.com/AppIssueBadWord.html
>
> See these Knowledge Base articles for more information about reserved words
> and characters that should not be used:
>
> List of reserved words in Access 2002 and Access 2003
> http://support.microsoft.com/default.aspx?scid=kb;en-us;286335
>
> List of Microsoft Jet 4.0 reserved words
> http://support.microsoft.com/?id=321266
>
> Special characters that you must avoid when you work with Access
> databases
> http://support.microsoft.com/?id=826763
>
> See this site for code that allows you to validate your names as not being
> VBA keywords:
>
> basIsValidIdent - Validate Names to Make Sure They Aren't VBA Keywords
> http://www.trigeminal.com/lang/1033/codes.asp?ItemID=18#18
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
>
> <debb...@ywcaofjamestown.com> wrote in message
>
> news:1191088129.660508.176560@g4g2000hsf.googlegroups.com...
>
>
>
> >I am trying to set an expiration date in my form. What it does is if
> > the classroom is Bumble Bears, then add 1 year to the field [Date].
> > If the classroom is Kool Kidz, then it needs to default to 9/1/? (?
> > being the year of the next 9/1). This is what I have so far. Can
> > anybody help. Thank you!
>
> > =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > ([ClassroomID]="Kool Kidz",9/1/2008))- Hide quoted text -
>
> - Show quoted text -
What am I doing wrong. Has something to do with missing parentheis.
=Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
([ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
([ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
([ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
([ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
(CLng(Format(Date(),"mmdd"))>901), 9, 1))
|
|
0
|
|
|
|
Reply
|
debbiep
|
9/30/2007 2:18:02 AM
|
|
On Sep 29, 10:18 pm, "debb...@ywcaofjamestown.com"
<debb...@ywcaofjamestown.com> wrote:
> On Sep 29, 4:02 pm, "Ken Snell \(MVP\)"
>
>
>
>
>
> <kthsneisll...@ncoomcastt.renaetl> wrote:
> > You need to test the current date and determine if it's later than 1
> > September so that you can determine the correct year to show. So change your
> > expression to this:
>
> > =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > [ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
> > (CLng(Format(Date(),"mmdd"))>901), 9, 1))
>
> > I note that you're using the word Date as the name of a field in your table.
> > It and many other words are reserved words in ACCESS and should not be used
> > for control names, field names, etc. Allen Browne (MVP) has a very
> > comprehensive list of reserved words at his website:
>
> > Problem names and reserved words in Accesshttp://www.allenbrowne.com/AppIssueBadWord.html
>
> > See these Knowledge Base articles for more information about reserved words
> > and characters that should not be used:
>
> > List of reserved words in Access 2002 and Access 2003
> > http://support.microsoft.com/default.aspx?scid=kb;en-us;286335
>
> > List of Microsoft Jet 4.0 reserved words
> > http://support.microsoft.com/?id=321266
>
> > Special characters that you must avoid when you work with Access
> > databases
> > http://support.microsoft.com/?id=826763
>
> > See this site for code that allows you to validate your names as not being
> > VBA keywords:
>
> > basIsValidIdent - Validate Names to Make Sure They Aren't VBA Keywords
> > http://www.trigeminal.com/lang/1033/codes.asp?ItemID=18#18
>
> > --
>
> > Ken Snell
> > <MS ACCESS MVP>
>
> > <debb...@ywcaofjamestown.com> wrote in message
>
> >news:1191088129.660508.176560@g4g2000hsf.googlegroups.com...
>
> > >I am trying to set an expiration date in my form. What it does is if
> > > the classroom is Bumble Bears, then add 1 year to the field [Date].
> > > If the classroom is Kool Kidz, then it needs to default to 9/1/? (?
> > > being the year of the next 9/1). This is what I have so far. Can
> > > anybody help. Thank you!
>
> > > =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > > ([ClassroomID]="Kool Kidz",9/1/2008))- Hide quoted text -
>
> > - Show quoted text -
>
> What am I doing wrong. Has something to do with missing parentheis.
>
> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> ([ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> ([ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> ([ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> ([ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
> (CLng(Format(Date(),"mmdd"))>901), 9, 1))- Hide quoted text -
>
> - Show quoted text -
It works great to a point. Kool Kidz only should default to 9/1/?
only if [Date] is >=9/1/07
|
|
0
|
|
|
|
Reply
|
debbiep
|
9/30/2007 2:40:20 AM
|
|
On Sep 29, 10:18 pm, "debb...@ywcaofjamestown.com"
<debb...@ywcaofjamestown.com> wrote:
> On Sep 29, 4:02 pm, "Ken Snell \(MVP\)"
>
>
>
>
>
> <kthsneisll...@ncoomcastt.renaetl> wrote:
> > You need to test the current date and determine if it's later than 1
> > September so that you can determine the correct year to show. So change your
> > expression to this:
>
> > =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > [ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
> > (CLng(Format(Date(),"mmdd"))>901), 9, 1))
>
> > I note that you're using the word Date as the name of a field in your table.
> > It and many other words are reserved words in ACCESS and should not be used
> > for control names, field names, etc. Allen Browne (MVP) has a very
> > comprehensive list of reserved words at his website:
>
> > Problem names and reserved words in Accesshttp://www.allenbrowne.com/AppIssueBadWord.html
>
> > See these Knowledge Base articles for more information about reserved words
> > and characters that should not be used:
>
> > List of reserved words in Access 2002 and Access 2003
> > http://support.microsoft.com/default.aspx?scid=kb;en-us;286335
>
> > List of Microsoft Jet 4.0 reserved words
> > http://support.microsoft.com/?id=321266
>
> > Special characters that you must avoid when you work with Access
> > databases
> > http://support.microsoft.com/?id=826763
>
> > See this site for code that allows you to validate your names as not being
> > VBA keywords:
>
> > basIsValidIdent - Validate Names to Make Sure They Aren't VBA Keywords
> > http://www.trigeminal.com/lang/1033/codes.asp?ItemID=18#18
>
> > --
>
> > Ken Snell
> > <MS ACCESS MVP>
>
> > <debb...@ywcaofjamestown.com> wrote in message
>
> >news:1191088129.660508.176560@g4g2000hsf.googlegroups.com...
>
> > >I am trying to set an expiration date in my form. What it does is if
> > > the classroom is Bumble Bears, then add 1 year to the field [Date].
> > > If the classroom is Kool Kidz, then it needs to default to 9/1/? (?
> > > being the year of the next 9/1). This is what I have so far. Can
> > > anybody help. Thank you!
>
> > > =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > > ([ClassroomID]="Kool Kidz",9/1/2008))- Hide quoted text -
>
> > - Show quoted text -
>
> What am I doing wrong. Has something to do with missing parentheis.
>
> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> ([ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> ([ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> ([ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> ([ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
> (CLng(Format(Date(),"mmdd"))>901), 9, 1))- Hide quoted text -
>
> - Show quoted text -
I did figure out the parenthesis part.
|
|
0
|
|
|
|
Reply
|
debbiep
|
9/30/2007 2:40:52 AM
|
|
<debbiep@ywcaofjamestown.com> wrote in message
news:1191120020.372016.73360@r29g2000hsg.googlegroups.com...
>> What am I doing wrong. Has something to do with missing parentheis.
>>
>> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
>> ([ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
>> ([ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
>> ([ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
>> ([ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
>> (CLng(Format(Date(),"mmdd"))>901), 9, 1))- Hide quoted text -
>>
>> - Show quoted text -
>
> It works great to a point. Kool Kidz only should default to 9/1/?
> only if [Date] is >=9/1/07
>
The expression I provided for when [ClassroomID]="Kool Kidz" should give you
a date of 9/1/07 for a current date (returned by the Date() function, which
gives you today's date) that is between January 1, 2007 and September 1,
2007; and a date of 9/1/08 for a current date of September 2, 2007 through
September 1, 2008.
Perhaps you don't want to test against today's date, but against the value
of the [Date] field in your table? If yes, then replace
Date()
with
[Date]
in the expression in both places where it's found:
DateSerial(Year([Date]) - (CLng(Format([Date],"mmdd"))>901), 9, 1)
--
Ken Snell
<MS ACCESS MVP>
|
|
0
|
|
|
|
Reply
|
Ken
|
9/30/2007 2:50:58 AM
|
|
On Sep 29, 10:50 pm, "Ken Snell \(MVP\)"
<kthsneisll...@ncoomcastt.renaetl> wrote:
> <debb...@ywcaofjamestown.com> wrote in message
>
> news:1191120020.372016.73360@r29g2000hsg.googlegroups.com...
>
> >> What am I doing wrong. Has something to do with missing parentheis.
>
> >> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> >> ([ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> >> ([ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> >> ([ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> >> ([ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
> >> (CLng(Format(Date(),"mmdd"))>901), 9, 1))- Hide quoted text -
>
> >> - Show quoted text -
>
> > It works great to a point. Kool Kidz only should default to 9/1/?
> > only if [Date] is >=9/1/07
>
> The expression I provided for when [ClassroomID]="Kool Kidz" should give you
> a date of 9/1/07 for a current date (returned by the Date() function, which
> gives you today's date) that is between January 1, 2007 and September 1,
> 2007; and a date of 9/1/08 for a current date of September 2, 2007 through
> September 1, 2008.
>
> Perhaps you don't want to test against today's date, but against the value
> of the [Date] field in your table? If yes, then replace
> Date()
> with
> [Date]
> in the expression in both places where it's found:
> DateSerial(Year([Date]) - (CLng(Format([Date],"mmdd"))>901), 9, 1)
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
It says that "the expression you entered contains invalid syntax, or
you need to enclose your text data in quotes. Below is the formula I
pasted into ACCESS. Thank you again for you support.
=Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
[ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
[ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
[ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
[ClassroomID]="Kool Kidz"),DateSerial(Year([Date]) -
(CLng(Format([Date],"mmdd"))>901), 9, 1)
|
|
0
|
|
|
|
Reply
|
debbiep
|
9/30/2007 3:33:57 AM
|
|
On Sep 29, 11:33 pm, "debb...@ywcaofjamestown.com"
<debb...@ywcaofjamestown.com> wrote:
> On Sep 29, 10:50 pm, "Ken Snell \(MVP\)"
>
>
>
> <kthsneisll...@ncoomcastt.renaetl> wrote:
> > <debb...@ywcaofjamestown.com> wrote in message
>
> >news:1191120020.372016.73360@r29g2000hsg.googlegroups.com...
>
> > >> What am I doing wrong. Has something to do with missing parentheis.
>
> > >> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > >> ([ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> > >> ([ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> > >> ([ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> > >> ([ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
> > >> (CLng(Format(Date(),"mmdd"))>901), 9, 1))- Hide quoted text -
>
> > >> - Show quoted text -
>
> > > It works great to a point. Kool Kidz only should default to 9/1/?
> > > only if [Date] is >=9/1/07
>
> > The expression I provided for when [ClassroomID]="Kool Kidz" should give you
> > a date of 9/1/07 for a current date (returned by the Date() function, which
> > gives you today's date) that is between January 1, 2007 and September 1,
> > 2007; and a date of 9/1/08 for a current date of September 2, 2007 through
> > September 1, 2008.
>
> > Perhaps you don't want to test against today's date, but against the value
> > of the [Date] field in your table? If yes, then replace
> > Date()
> > with
> > [Date]
> > in the expression in both places where it's found:
> > DateSerial(Year([Date]) - (CLng(Format([Date],"mmdd"))>901), 9, 1)
>
> > --
>
> > Ken Snell
> > <MS ACCESS MVP>
>
> It says that "the expression you entered contains invalid syntax, or
> you need to enclose your text data in quotes. Below is the formula I
> pasted into ACCESS. Thank you again for you support.
>
> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> [ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> [ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> [ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> [ClassroomID]="Kool Kidz"),DateSerial(Year([Date]) -
> (CLng(Format([Date],"mmdd"))>901), 9, 1)- Hide quoted text -
>
> - Show quoted text -
ok, great. I got it working. Had to many parenthesis. Thank you so
much for your time.
|
|
0
|
|
|
|
Reply
|
debbiep
|
9/30/2007 3:50:40 AM
|
|
On Sep 29, 11:33 pm, "debb...@ywcaofjamestown.com"
<debb...@ywcaofjamestown.com> wrote:
> On Sep 29, 10:50 pm, "Ken Snell \(MVP\)"
>
>
>
> <kthsneisll...@ncoomcastt.renaetl> wrote:
> > <debb...@ywcaofjamestown.com> wrote in message
>
> >news:1191120020.372016.73360@r29g2000hsg.googlegroups.com...
>
> > >> What am I doing wrong. Has something to do with missing parentheis.
>
> > >> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > >> ([ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> > >> ([ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> > >> ([ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> > >> ([ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
> > >> (CLng(Format(Date(),"mmdd"))>901), 9, 1))- Hide quoted text -
>
> > >> - Show quoted text -
>
> > > It works great to a point. Kool Kidz only should default to 9/1/?
> > > only if [Date] is >=9/1/07
>
> > The expression I provided for when [ClassroomID]="Kool Kidz" should give you
> > a date of 9/1/07 for a current date (returned by the Date() function, which
> > gives you today's date) that is between January 1, 2007 and September 1,
> > 2007; and a date of 9/1/08 for a current date of September 2, 2007 through
> > September 1, 2008.
>
> > Perhaps you don't want to test against today's date, but against the value
> > of the [Date] field in your table? If yes, then replace
> > Date()
> > with
> > [Date]
> > in the expression in both places where it's found:
> > DateSerial(Year([Date]) - (CLng(Format([Date],"mmdd"))>901), 9, 1)
>
> > --
>
> > Ken Snell
> > <MS ACCESS MVP>
>
> It says that "the expression you entered contains invalid syntax, or
> you need to enclose your text data in quotes. Below is the formula I
> pasted into ACCESS. Thank you again for you support.
>
> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> [ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> [ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> [ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> [ClassroomID]="Kool Kidz"),DateSerial(Year([Date]) -
> (CLng(Format([Date],"mmdd"))>901), 9, 1)- Hide quoted text -
>
> - Show quoted text -
One more question. It works great if the [Date] is 9/2/07 and greater.
Now my situation is if the [Date], for example is 8/31/07, it shows an
expiration date of 9/1/07. If the [Date] is less than 9/2/07, it
needs to be 1 year from that date. Is this possible. Thanks again.
|
|
0
|
|
|
|
Reply
|
debbiep
|
9/30/2007 4:11:53 AM
|
|
On Sep 30, 12:11 am, "debb...@ywcaofjamestown.com"
<debb...@ywcaofjamestown.com> wrote:
> On Sep 29, 11:33 pm, "debb...@ywcaofjamestown.com"
>
>
>
>
>
> <debb...@ywcaofjamestown.com> wrote:
> > On Sep 29, 10:50 pm, "Ken Snell \(MVP\)"
>
> > <kthsneisll...@ncoomcastt.renaetl> wrote:
> > > <debb...@ywcaofjamestown.com> wrote in message
>
> > >news:1191120020.372016.73360@r29g2000hsg.googlegroups.com...
>
> > > >> What am I doing wrong. Has something to do with missing parentheis.
>
> > > >> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > > >> ([ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> > > >> ([ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> > > >> ([ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> > > >> ([ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
> > > >> (CLng(Format(Date(),"mmdd"))>901), 9, 1))- Hide quoted text -
>
> > > >> - Show quoted text -
>
> > > > It works great to a point. Kool Kidz only should default to 9/1/?
> > > > only if [Date] is >=9/1/07
>
> > > The expression I provided for when [ClassroomID]="Kool Kidz" should give you
> > > a date of 9/1/07 for a current date (returned by the Date() function, which
> > > gives you today's date) that is between January 1, 2007 and September 1,
> > > 2007; and a date of 9/1/08 for a current date of September 2, 2007 through
> > > September 1, 2008.
>
> > > Perhaps you don't want to test against today's date, but against the value
> > > of the [Date] field in your table? If yes, then replace
> > > Date()
> > > with
> > > [Date]
> > > in the expression in both places where it's found:
> > > DateSerial(Year([Date]) - (CLng(Format([Date],"mmdd"))>901), 9, 1)
>
> > > --
>
> > > Ken Snell
> > > <MS ACCESS MVP>
>
> > It says that "the expression you entered contains invalid syntax, or
> > you need to enclose your text data in quotes. Below is the formula I
> > pasted into ACCESS. Thank you again for you support.
>
> > =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > [ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> > [ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> > [ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> > [ClassroomID]="Kool Kidz"),DateSerial(Year([Date]) -
> > (CLng(Format([Date],"mmdd"))>901), 9, 1)- Hide quoted text -
>
> > - Show quoted text -
>
> One more question. It works great if the [Date] is 9/2/07 and greater.
> Now my situation is if the [Date], for example is 8/31/07, it shows an
> expiration date of 9/1/07. If the [Date] is less than 9/2/07, it
> needs to be 1 year from [Date]. Is this possible. Thanks again.- Hide quoted text -
>
> - Show quoted text -
|
|
0
|
|
|
|
Reply
|
debbiep
|
9/30/2007 4:13:25 AM
|
|
On Sep 30, 12:13 am, "debb...@ywcaofjamestown.com"
<debb...@ywcaofjamestown.com> wrote:
> On Sep 30, 12:11 am, "debb...@ywcaofjamestown.com"
>
>
>
> <debb...@ywcaofjamestown.com> wrote:
> > On Sep 29, 11:33 pm, "debb...@ywcaofjamestown.com"
>
> > <debb...@ywcaofjamestown.com> wrote:
> > > On Sep 29, 10:50 pm, "Ken Snell \(MVP\)"
>
> > > <kthsneisll...@ncoomcastt.renaetl> wrote:
> > > > <debb...@ywcaofjamestown.com> wrote in message
>
> > > >news:1191120020.372016.73360@r29g2000hsg.googlegroups.com...
>
> > > > >> What am I doing wrong. Has something to do with missing parentheis.
>
> > > > >> =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > > > >> ([ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> > > > >> ([ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> > > > >> ([ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> > > > >> ([ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
> > > > >> (CLng(Format(Date(),"mmdd"))>901), 9, 1))- Hide quoted text -
>
> > > > >> - Show quoted text -
>
> > > > > It works great to a point. Kool Kidz only should default to 9/1/?
> > > > > only if [Date] is >=9/1/07
>
> > > > The expression I provided for when [ClassroomID]="Kool Kidz" should give you
> > > > a date of 9/1/07 for a current date (returned by the Date() function, which
> > > > gives you today's date) that is between January 1, 2007 and September 1,
> > > > 2007; and a date of 9/1/08 for a current date of September 2, 2007 through
> > > > September 1, 2008.
>
> > > > Perhaps you don't want to test against today's date, but against the value
> > > > of the [Date] field in your table? If yes, then replace
> > > > Date()
> > > > with
> > > > [Date]
> > > > in the expression in both places where it's found:
> > > > DateSerial(Year([Date]) - (CLng(Format([Date],"mmdd"))>901), 9, 1)
>
> > > > --
>
> > > > Ken Snell
> > > > <MS ACCESS MVP>
>
> > > It says that "the expression you entered contains invalid syntax, or
> > > you need to enclose your text data in quotes. Below is the formula I
> > > pasted into ACCESS. Thank you again for you support.
>
> > > =Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
> > > [ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
> > > [ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
> > > [ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
> > > [ClassroomID]="Kool Kidz"),DateSerial(Year([Date]) -
> > > (CLng(Format([Date],"mmdd"))>901), 9, 1)- Hide quoted text -
>
> > > - Show quoted text -
>
> > One more question. It works great if the [Date] is 9/2/07 and greater.
> > Now my situation is if the [Date], for example is 8/31/07, it shows an
> > expiration date of 9/1/07. If the [Date] is less than 9/2/07, it
> > needs to be 1 year from [Date]. Is this possible. Thanks again.- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
YEAH. I got it. Thank you for all your suggestions. This is the final
formula.
=IIf([ClassroomID]="Kool Kidz" And
(Format([Date],"mmdd")>901),DateSerial(Year([Date])-
(CLng(Format([Date],"mmdd"))>901),9,1),DateAdd("yyyy",1,[Date]))
|
|
0
|
|
|
|
Reply
|
debbiep
|
9/30/2007 6:36:37 PM
|
|
<debbiep@ywcaofjamestown.com> wrote in message
news:1191177397.834279.157670@19g2000hsx.googlegroups.com...
>
> YEAH. I got it. Thank you for all your suggestions. This is the final
> formula.
>
> =IIf([ClassroomID]="Kool Kidz" And
> (Format([Date],"mmdd")>901),DateSerial(Year([Date])-
> (CLng(Format([Date],"mmdd"))>901),9,1),DateAdd("yyyy",1,[Date]))
>
Congratulations to you for solving the issue. Good luck.
--
Ken Snell
<MS ACCESS MVP>
|
|
0
|
|
|
|
Reply
|
Ken
|
9/30/2007 7:21:53 PM
|
|
|
11 Replies
228 Views
(page loaded in 0.201 seconds)
Similiar Articles: Working with Expiration Dates - microsoft.public.access.forms ...I am trying to set an expiration date in my form. What it does is if the classroom is Bumble Bears, then add 1 year to the field [Date]. If the class... Need calculated control to work - microsoft.public.access.forms ...I have a subform with fields: first name, last name, phone, expiration date, membership status. I want a calculated control to display the total numb... Excel 2007 Traffic Light with dates - microsoft.public.excel.misc ...In the expiration date cells I want traffic lights indicating: red once the ... Working with Expiration Dates - microsoft.public.access.forms ... Excel 2007 Traffic Light ... Account Expiration Date - microsoft.public.sharepoint.general ...Take the date you want the account to expire on and substract the max password age from ... Working with Expiration Dates - microsoft.public.access.forms ... Management Reporter Default Dates - microsoft.public.greatplains ...Management Reporter Default Dates - microsoft.public ... work, however when I try to ... When the expiration date ... Management Reporter for Microsoft Dynamics ERP Data ... Using POS 2009 with First Data For Credit Card Processing ...Working with Expiration Dates - microsoft.public.access.forms ... Using POS 2009 with First Data For Credit Card Processing ..... Data For Credit Card Processing (comes ... If before today's date insert Expired - microsoft.public ...Linda "Linda RQ" <RomulanQueen@Work.SSTNG> wrote in message news ... If before today's date insert Expired - microsoft.public ... Calculating Expiration Dates ... A calculated field in access - microsoft.public.access.queries ...I need an Expression to extend the purchase date to a warranty expiration date based on ... > > > "Candy Pierce" wrote: > > > Here is the problem that I am working on in access ... Download Free Church Information System , built in MS Access ...Working with Expiration Dates - microsoft.public.access.forms ..... 901), 9, 1) > > -- > > Ken Snell > <MS ACCESS ... For Credit Card Processing (comes with the system ... change text to date - microsoft.public.access.queriesI wish to do this to facilitate MS KB210534 credit card expiration date method. ... I have a form that filters between two dates and need it to work with a text field that I ... Calculating Dates - microsoft.public.accessCalculating Expiration Dates - microsoft.public.access Calculating ... In order to calculate the working days (Mon-Thu) between two dates use: =NETWORKDAYS(A1,A2 ... Calculating Quarters from Dates - microsoft.public.excel.misc ...Calculating Expiration Dates - microsoft.public.access Calculating Quarters from Dates ... how to calculate a projected date - microsoft.public.excel ... I'm working on ... Conditional formatting dates - microsoft.public.mac.office.excel ...Conditional formatting not working as expected (A2007) - microsoft ... I've got 4 ... formatting dates - Microsoft Answers I have an Excel worksheet displaying expiration dates ... Is it possible to reset "pwdLastSet" attribute to certain date? FollowHi, Anyone able to review the script I treid why not working? Thanks. ... Account Expiration Date - microsoft.public.sharepoint.general ... Is it possible to reset ... DPM 2010, Multiple Protection Groups to 1 Tape - microsoft.public ...Tapes have been properly formated/cleaned for use with DPM and work fine when ... the different PGs are all the same - DPM won't write PGs with differing expiration dates ... Display records on the form based on the selection - microsoft ..."It doesn't work. What's wrong?" is somewhat of an ambiguous question, so I'll ... records from > continues years and contains two fields Effective Date and Expiration Date ... Calculating Date Fields - microsoft.public.word.vba.general ...Calculating Expiration Dates - microsoft.public.access If before today's date insert ... ArcGIS Desktop Help 9.3 - Working with date fields If you calculate a date field to 1 ... Expired Money Plus, what to do? - microsoft.public.money ...Frequently asked questions about the activation of Money Plus If you see an expiration date, Money has been activated successfully. Q10: Does the product stop working if I ... Problem sorting and filtering on a calculated field - microsoft ...Here is the problem that I am working on in access ... • Create a calculated field to extend the purchase date to a ... Sort by nearest expiration dates. Change date to days - microsoft.public.projectChanging Start Date affects Duration and/or Work in 2007 (not in ... Change date to days ... I wish to do this to facilitate MS KB210534 credit card expiration date ... Working with Expiration Dates - microsoft.public.access.forms ...I am trying to set an expiration date in my form. What it does is if the classroom is Bumble Bears, then add 1 year to the field [Date]. If the class... Do Food Expiration Dates Really Matter?The actual term "Expiration Date" refers to the last date a food should be eaten or used. ... Which Drugstore Tooth Whiteners Work Best? Is Your Psoriasis Treatment Working? Surprising Expiration Dates | Work + Money - Yahoo! ShineFrom the blog Work + Money: A handy, who-knew guide to 77 foods, beauty products, and household goods Certain items in your house practically scream "toss me" when ... credit card numbers that work with expiration date - (2012 with ...Click Here For Free Download http://ultimatehackersite.blogspot.com/ 100% WORKING Credit Card Generator 2011 with cvv and expiration ...Credit Card Generator 2011 with cvv and expiration date. Working Credit Card Numbers Generator Free Download Download Credit Card Generator 2011 (100%) working ... credit card numbers that work 2011 with CVV and Expiration Date ...credit card numbers that work 2011 with CVV and Expiration Date 2013 2012 100% Working Tested Proof WorkCompXdates.com Insurance Renewal DatesHow many cold calls do you or your producers make to get a single expiration date? Set yourself or your producers up for success by giving them the tools they need to be ... Can proactiv expire? Does it stop working after a certain age ...Can proactiv expire? Does it stop working after a certain age? ChaCha Answer: Proactiv acne solution does have an expiration date. Th... Ink Expiration - HP Customer Care (United States - English)What is ink expiration? Why does it exist? Is there something built into HP ink supplies that make them stop working on a certain date? These questions may have ... Does Sunscreen Work After Its Expiration Date - DermTV, Internet ...Dr. Schultz will explain about Sunscreen Work After Its Expiration Date. Watch skincare videos hosted by Dr. Schultz & learn how to get a beautiful younger looking skin. 7/23/2012 9:05:48 AM
|