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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

A Complex Date Command?



 
 
Thread Tools Display Modes
  #1  
Old November 2nd, 2006, 01:50 AM posted to microsoft.public.access.forms
Curtis Stevens
external usenet poster
 
Posts: 231
Default A Complex Date Command?

a text box named - MerchantDOB
a command button named - CmdDOBAdj

MerchantDOB may have someone's dob, like 06/02/1981. I can't use that
format to be able to know when their bday is up, so I must convert it to
06/02/2007.

Here's the tricky part. When I click the cmd button, I want it to change
the dob in the text box according to what it is & what the current date is
(today's date).

For example, today's date is 11/1/06. If their DOB is 1/1/XX to 11/1/XX
then I want it to change it to XX/XX/2007. But if it is 11/2/XX to 12/31/XX,
then change it to XX/XX/2006. And this range would change accordinly with
the current day's date.

The only part that changes is the yr, from their DOB yr to 2006 or 2007. I
then up it by one yr with another cmd button on the day of their bday so it
comes around again next yr and so on.

Is this too complicated?

Thanks
Curtis

  #2  
Old November 2nd, 2006, 02:06 AM posted to microsoft.public.access.forms
Damian S
external usenet poster
 
Posts: 741
Default A Complex Date Command?

Hi Curtis,

You will lose data if you overwrite the DOB with a new date. I would
consider doing it another way. Be that as it may, using code similar to this
will achieve what you are after:

me.MerchantDOB = iif(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)

Damian.

"Curtis Stevens" wrote:

a text box named - MerchantDOB
a command button named - CmdDOBAdj

MerchantDOB may have someone's dob, like 06/02/1981. I can't use that
format to be able to know when their bday is up, so I must convert it to
06/02/2007.

Here's the tricky part. When I click the cmd button, I want it to change
the dob in the text box according to what it is & what the current date is
(today's date).

For example, today's date is 11/1/06. If their DOB is 1/1/XX to 11/1/XX
then I want it to change it to XX/XX/2007. But if it is 11/2/XX to 12/31/XX,
then change it to XX/XX/2006. And this range would change accordinly with
the current day's date.

The only part that changes is the yr, from their DOB yr to 2006 or 2007. I
then up it by one yr with another cmd button on the day of their bday so it
comes around again next yr and so on.

Is this too complicated?

Thanks
Curtis

  #3  
Old November 2nd, 2006, 02:31 AM posted to microsoft.public.access.forms
Curtis Stevens
external usenet poster
 
Posts: 231
Default A Complex Date Command?

Hi Damian,

I tried this, but it is looking for more code, if statement not done? Can't
figure this out, little beyond my head.

Private Sub CmdDOBCopy_Click()
me.MerchantDOB = if(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)
End Sub



You will lose data if you overwrite the DOB with a new date. I would
consider doing it another way. Be that as it may, using code similar to this
will achieve what you are after:

me.MerchantDOB = iif(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)

Damian.

"Curtis Stevens" wrote:

a text box named - MerchantDOB
a command button named - CmdDOBAdj

MerchantDOB may have someone's dob, like 06/02/1981. I can't use that
format to be able to know when their bday is up, so I must convert it to
06/02/2007.

Here's the tricky part. When I click the cmd button, I want it to change
the dob in the text box according to what it is & what the current date is
(today's date).

For example, today's date is 11/1/06. If their DOB is 1/1/XX to 11/1/XX
then I want it to change it to XX/XX/2007. But if it is 11/2/XX to 12/31/XX,
then change it to XX/XX/2006. And this range would change accordinly with
the current day's date.

The only part that changes is the yr, from their DOB yr to 2006 or 2007. I
then up it by one yr with another cmd button on the day of their bday so it
comes around again next yr and so on.

Is this too complicated?

Thanks
Curtis

  #4  
Old November 2nd, 2006, 02:48 AM posted to microsoft.public.access.forms
Damian S
external usenet poster
 
Posts: 741
Default A Complex Date Command?

Hi Curtis,

it's IIF not IF... the double I at the front wasn't a typo...

D.

"Curtis Stevens" wrote:

Hi Damian,

I tried this, but it is looking for more code, if statement not done? Can't
figure this out, little beyond my head.

Private Sub CmdDOBCopy_Click()
me.MerchantDOB = if(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)
End Sub



You will lose data if you overwrite the DOB with a new date. I would
consider doing it another way. Be that as it may, using code similar to this
will achieve what you are after:

me.MerchantDOB = iif(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)

Damian.

"Curtis Stevens" wrote:

a text box named - MerchantDOB
a command button named - CmdDOBAdj

MerchantDOB may have someone's dob, like 06/02/1981. I can't use that
format to be able to know when their bday is up, so I must convert it to
06/02/2007.

Here's the tricky part. When I click the cmd button, I want it to change
the dob in the text box according to what it is & what the current date is
(today's date).

For example, today's date is 11/1/06. If their DOB is 1/1/XX to 11/1/XX
then I want it to change it to XX/XX/2007. But if it is 11/2/XX to 12/31/XX,
then change it to XX/XX/2006. And this range would change accordinly with
the current day's date.

The only part that changes is the yr, from their DOB yr to 2006 or 2007. I
then up it by one yr with another cmd button on the day of their bday so it
comes around again next yr and so on.

Is this too complicated?

Thanks
Curtis

  #5  
Old November 2nd, 2006, 02:49 AM posted to microsoft.public.access.forms
David F Cox
external usenet poster
 
Posts: 493
Default A Complex Date Command?

apologies if I am missing the plot.

To me it looks as simple as:
If Format([dob],"mm:dd") = Format(date(),"mm:dd") then ' its a birthday!


"Curtis Stevens" wrote in message
...
a text box named - MerchantDOB
a command button named - CmdDOBAdj

MerchantDOB may have someone's dob, like 06/02/1981. I can't use that
format to be able to know when their bday is up, so I must convert it to
06/02/2007.

Here's the tricky part. When I click the cmd button, I want it to change
the dob in the text box according to what it is & what the current date is
(today's date).

For example, today's date is 11/1/06. If their DOB is 1/1/XX to 11/1/XX
then I want it to change it to XX/XX/2007. But if it is 11/2/XX to
12/31/XX,
then change it to XX/XX/2006. And this range would change accordinly with
the current day's date.

The only part that changes is the yr, from their DOB yr to 2006 or 2007.
I
then up it by one yr with another cmd button on the day of their bday so
it
comes around again next yr and so on.

Is this too complicated?

Thanks
Curtis




  #6  
Old November 2nd, 2006, 03:07 AM posted to microsoft.public.access.forms
Curtis Stevens
external usenet poster
 
Posts: 231
Default A Complex Date Command?

I thought it was giving me an error.

I tried this, seems to work for any date range that needs to go to 2007, but
any thing from tomorrows date until the end of the yr is changing to 2007 and
not 06.

Curtis


it's IIF not IF... the double I at the front wasn't a typo...

D.

"Curtis Stevens" wrote:

Hi Damian,

I tried this, but it is looking for more code, if statement not done? Can't
figure this out, little beyond my head.

Private Sub CmdDOBCopy_Click()
me.MerchantDOB = if(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)
End Sub



You will lose data if you overwrite the DOB with a new date. I would
consider doing it another way. Be that as it may, using code similar to this
will achieve what you are after:

me.MerchantDOB = iif(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)

Damian.

"Curtis Stevens" wrote:

a text box named - MerchantDOB
a command button named - CmdDOBAdj

MerchantDOB may have someone's dob, like 06/02/1981. I can't use that
format to be able to know when their bday is up, so I must convert it to
06/02/2007.

Here's the tricky part. When I click the cmd button, I want it to change
the dob in the text box according to what it is & what the current date is
(today's date).

For example, today's date is 11/1/06. If their DOB is 1/1/XX to 11/1/XX
then I want it to change it to XX/XX/2007. But if it is 11/2/XX to 12/31/XX,
then change it to XX/XX/2006. And this range would change accordinly with
the current day's date.

The only part that changes is the yr, from their DOB yr to 2006 or 2007. I
then up it by one yr with another cmd button on the day of their bday so it
comes around again next yr and so on.

Is this too complicated?

Thanks
Curtis

  #7  
Old November 2nd, 2006, 03:07 AM posted to microsoft.public.access.forms
Damian S
external usenet poster
 
Posts: 741
Default A Complex Date Command?

I reckon that's what he should be doing, but that's not what he specifically
asked...

"David F Cox" wrote:

apologies if I am missing the plot.

To me it looks as simple as:
If Format([dob],"mm:dd") = Format(date(),"mm:dd") then ' its a birthday!


"Curtis Stevens" wrote in message
...
a text box named - MerchantDOB
a command button named - CmdDOBAdj

MerchantDOB may have someone's dob, like 06/02/1981. I can't use that
format to be able to know when their bday is up, so I must convert it to
06/02/2007.

Here's the tricky part. When I click the cmd button, I want it to change
the dob in the text box according to what it is & what the current date is
(today's date).

For example, today's date is 11/1/06. If their DOB is 1/1/XX to 11/1/XX
then I want it to change it to XX/XX/2007. But if it is 11/2/XX to
12/31/XX,
then change it to XX/XX/2006. And this range would change accordinly with
the current day's date.

The only part that changes is the yr, from their DOB yr to 2006 or 2007.
I
then up it by one yr with another cmd button on the day of their bday so
it
comes around again next yr and so on.

Is this too complicated?

Thanks
Curtis





  #8  
Old November 2nd, 2006, 03:13 AM posted to microsoft.public.access.forms
Curtis Stevens
external usenet poster
 
Posts: 231
Default A Complex Date Command?

I need the data like that as I do a lot with it. I have it setup so I go
through my forms, see which birthday cards that need to be mailed, which go
out 7 days before the day of or send out emails on the day of. I also use
the data to know who gets the cards - to stuff the envelopes & print out
labels for the month before, to get it all prepared, etc.

That's why I need the data this way, do a lot of stuff with it!

Curtis

I reckon that's what he should be doing, but that's not what he specifically
asked...

  #9  
Old November 2nd, 2006, 03:20 AM posted to microsoft.public.access.forms
Damian S
external usenet poster
 
Posts: 741
Default A Complex Date Command?

No worries... Use this one instead:

me.MerchantDOB = iif(format(me.MerchantDOB, "yyyy/mm") = format(date(),
"yyyy/mm"), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), cdate(year(date) & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)))

Damian.

"Curtis Stevens" wrote:

I thought it was giving me an error.

I tried this, seems to work for any date range that needs to go to 2007, but
any thing from tomorrows date until the end of the yr is changing to 2007 and
not 06.

Curtis


it's IIF not IF... the double I at the front wasn't a typo...

D.

"Curtis Stevens" wrote:

Hi Damian,

I tried this, but it is looking for more code, if statement not done? Can't
figure this out, little beyond my head.

Private Sub CmdDOBCopy_Click()
me.MerchantDOB = if(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)
End Sub



You will lose data if you overwrite the DOB with a new date. I would
consider doing it another way. Be that as it may, using code similar to this
will achieve what you are after:

me.MerchantDOB = iif(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)

Damian.

"Curtis Stevens" wrote:

a text box named - MerchantDOB
a command button named - CmdDOBAdj

MerchantDOB may have someone's dob, like 06/02/1981. I can't use that
format to be able to know when their bday is up, so I must convert it to
06/02/2007.

Here's the tricky part. When I click the cmd button, I want it to change
the dob in the text box according to what it is & what the current date is
(today's date).

For example, today's date is 11/1/06. If their DOB is 1/1/XX to 11/1/XX
then I want it to change it to XX/XX/2007. But if it is 11/2/XX to 12/31/XX,
then change it to XX/XX/2006. And this range would change accordinly with
the current day's date.

The only part that changes is the yr, from their DOB yr to 2006 or 2007. I
then up it by one yr with another cmd button on the day of their bday so it
comes around again next yr and so on.

Is this too complicated?

Thanks
Curtis

  #10  
Old November 2nd, 2006, 03:37 AM posted to microsoft.public.access.forms
Curtis Stevens
external usenet poster
 
Posts: 231
Default A Complex Date Command?

I pasted this and same thing?

No worries... Use this one instead:

me.MerchantDOB = iif(format(me.MerchantDOB, "yyyy/mm") = format(date(),
"yyyy/mm"), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), cdate(year(date) & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)))

Damian.

"Curtis Stevens" wrote:

I thought it was giving me an error.

I tried this, seems to work for any date range that needs to go to 2007, but
any thing from tomorrows date until the end of the yr is changing to 2007 and
not 06.

Curtis


it's IIF not IF... the double I at the front wasn't a typo...

D.

"Curtis Stevens" wrote:

Hi Damian,

I tried this, but it is looking for more code, if statement not done? Can't
figure this out, little beyond my head.

Private Sub CmdDOBCopy_Click()
me.MerchantDOB = if(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)
End Sub



You will lose data if you overwrite the DOB with a new date. I would
consider doing it another way. Be that as it may, using code similar to this
will achieve what you are after:

me.MerchantDOB = iif(me.MerchantDOB = date(), cdate(year(date) + 1 & "/" &
month(me.MerchantDOB) & "/" & day(me.MerchantDOB)), me.MerchantDOB)

Damian.

"Curtis Stevens" wrote:

a text box named - MerchantDOB
a command button named - CmdDOBAdj

MerchantDOB may have someone's dob, like 06/02/1981. I can't use that
format to be able to know when their bday is up, so I must convert it to
06/02/2007.

Here's the tricky part. When I click the cmd button, I want it to change
the dob in the text box according to what it is & what the current date is
(today's date).

For example, today's date is 11/1/06. If their DOB is 1/1/XX to 11/1/XX
then I want it to change it to XX/XX/2007. But if it is 11/2/XX to 12/31/XX,
then change it to XX/XX/2006. And this range would change accordinly with
the current day's date.

The only part that changes is the yr, from their DOB yr to 2006 or 2007. I
then up it by one yr with another cmd button on the day of their bday so it
comes around again next yr and so on.

Is this too complicated?

Thanks
Curtis

 




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 01:56 AM.


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