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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|