PC Review


Reply
Thread Tools Rate Thread

Calculating the date!

 
 
Bob Vance
Guest
Posts: n/a
 
      10th Jun 2010

I have 3 text boxes on my form tbServiceDate(Date) , tbWarn1(Number) ,
tbDayWarn1 (Date)
How can I have in form open event tbWarnDate1 will give me the date being
tbServiceDate plus tbWarn1
i.e. 12 May 2010 + 7 = 19 May 2010
Me.tbDayWarn1 = Me.tbServiceDate + Me.tbWarn1
--
Thanks in advance for any help with this......Bob
MS Access 2007 accdb
Windows XP Home Edition Ver 5.1 Service Pack 3


 
Reply With Quote
 
 
 
 
Jörn Bosse
Guest
Posts: n/a
 
      10th Jun 2010
Am 10.06.2010 10:48, schrieb Bob Vance:
> I have 3 text boxes on my form tbServiceDate(Date) , tbWarn1(Number) ,
> tbDayWarn1 (Date)
> How can I have in form open event tbWarnDate1 will give me the date being
> tbServiceDate plus tbWarn1
> i.e. 12 May 2010 + 7 = 19 May 2010
> Me.tbDayWarn1 = Me.tbServiceDate + Me.tbWarn1


Hi there,

use the DateAdd-Function. In the Load event like this:

Me.tbDayWarn1 = DateAdd("d", Me.tbWarn1, Me.tbServiceDate)

Regards
Jörn
 
Reply With Quote
 
Jeff Boyce
Guest
Posts: n/a
 
      10th Jun 2010
Bob

I've not been able to determine in which circumstances/conditions the
following happens, but I've had to deal with it:

1. An Access function/expression stops working and throws an error
message (not a consistent one).
2. The expression includes the Me. phrase, but it refers to an object
I created, rather than a property or method of the "Me".
3. I change the expression to "Me! something, and it works!

As I said, inconsistently, but I'm guessing that portions of Access got more
rigorous about how "Me." and "Me!" are interpreted.

Your expression uses "Me.", but refers to objects (textboxes) you created.
I'm guessing that you could use:

Me!tbDayWarn1 = Me!tbServiceDate + Me!tbWarn1

provided you format the tbDayWarn1 to display a date value.

Your code would be a bit more readable and self-documenting if you use the
DateAdd(), as suggested elsethread...

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.


"Bob Vance" <(E-Mail Removed)> wrote in message
news:huq8so$5ij$(E-Mail Removed)...
>
> I have 3 text boxes on my form tbServiceDate(Date) , tbWarn1(Number) ,
> tbDayWarn1 (Date)
> How can I have in form open event tbWarnDate1 will give me the date being
> tbServiceDate plus tbWarn1
> i.e. 12 May 2010 + 7 = 19 May 2010
> Me.tbDayWarn1 = Me.tbServiceDate + Me.tbWarn1
> --
> Thanks in advance for any help with this......Bob
> MS Access 2007 accdb
> Windows XP Home Edition Ver 5.1 Service Pack 3
>
>



 
Reply With Quote
 
Bob Vance
Guest
Posts: n/a
 
      10th Jun 2010

"Jörn Bosse" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Am 10.06.2010 10:48, schrieb Bob Vance:
>> I have 3 text boxes on my form tbServiceDate(Date) , tbWarn1(Number) ,
>> tbDayWarn1 (Date)
>> How can I have in form open event tbWarnDate1 will give me the date being
>> tbServiceDate plus tbWarn1
>> i.e. 12 May 2010 + 7 = 19 May 2010
>> Me.tbDayWarn1 = Me.tbServiceDate + Me.tbWarn1

>
> Hi there,
>
> use the DateAdd-Function. In the Load event like this:
>
> Me.tbDayWarn1 = DateAdd("d", Me.tbWarn1, Me.tbServiceDate)
>
> Regards
> Jörn


Thanks Jorn, worked great, just one little thing I have a control to take
away the date in tbServiceDate
tbServiceDate.value = ""
but unless I highlight the tbServiceDate and delete it I can get the date to
dissapear from tbDayWarn
Can I change
tbServiceDate.value = ""
Regards Bob


 
Reply With Quote
 
Jörn Bosse
Guest
Posts: n/a
 
      10th Jun 2010
Well sorry i didn´t get it. Do you want to delete the tbDayWarn1 value
or do you want it to stay if tbServiceDate has been cleared?

Regards
Jörn

Am 10.06.2010 20:35, schrieb Bob Vance:
> "Jörn Bosse"<(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Am 10.06.2010 10:48, schrieb Bob Vance:
>>> I have 3 text boxes on my form tbServiceDate(Date) , tbWarn1(Number) ,
>>> tbDayWarn1 (Date)
>>> How can I have in form open event tbWarnDate1 will give me the date being
>>> tbServiceDate plus tbWarn1
>>> i.e. 12 May 2010 + 7 = 19 May 2010
>>> Me.tbDayWarn1 = Me.tbServiceDate + Me.tbWarn1

>>
>> Hi there,
>>
>> use the DateAdd-Function. In the Load event like this:
>>
>> Me.tbDayWarn1 = DateAdd("d", Me.tbWarn1, Me.tbServiceDate)
>>
>> Regards
>> Jörn

>
> Thanks Jorn, worked great, just one little thing I have a control to take
> away the date in tbServiceDate
> tbServiceDate.value = ""
> but unless I highlight the tbServiceDate and delete it I can get the date to
> dissapear from tbDayWarn
> Can I change
> tbServiceDate.value = ""
> Regards Bob
>
>


 
Reply With Quote
 
Bob Vance
Guest
Posts: n/a
 
      13th Jun 2010
Thanks Jorn , I got around it using this code:
tbServiceDate.value = ""
tbDayWarn1.value = ""
tbDayWarn2.value = ""
tbDayWarn3.value = ""
tbDayWarn4.value = ""
tbDayWarn5.value = ""
tbDayWarn6.value = ""

So when i cleared the date ii also cleared the due dates as
well.........Regards Bob

"Jörn Bosse" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Well sorry i didn´t get it. Do you want to delete the tbDayWarn1 value or
> do you want it to stay if tbServiceDate has been cleared?
>
> Regards
> Jörn
>
> Am 10.06.2010 20:35, schrieb Bob Vance:
>> "Jörn Bosse"<(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Am 10.06.2010 10:48, schrieb Bob Vance:
>>>> I have 3 text boxes on my form tbServiceDate(Date) , tbWarn1(Number) ,
>>>> tbDayWarn1 (Date)
>>>> How can I have in form open event tbWarnDate1 will give me the date
>>>> being
>>>> tbServiceDate plus tbWarn1
>>>> i.e. 12 May 2010 + 7 = 19 May 2010
>>>> Me.tbDayWarn1 = Me.tbServiceDate + Me.tbWarn1
>>>
>>> Hi there,
>>>
>>> use the DateAdd-Function. In the Load event like this:
>>>
>>> Me.tbDayWarn1 = DateAdd("d", Me.tbWarn1, Me.tbServiceDate)
>>>
>>> Regards
>>> Jörn

>>
>> Thanks Jorn, worked great, just one little thing I have a control to take
>> away the date in tbServiceDate
>> tbServiceDate.value = ""
>> but unless I highlight the tbServiceDate and delete it I can get the date
>> to
>> dissapear from tbDayWarn
>> Can I change
>> tbServiceDate.value = ""
>> Regards Bob
>>
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CALCULATING A DATE 1YEAR FROM DATE ENTERED IN FIELD!!!!!! Liam.M@awamarine.com.au Microsoft Access Forms 6 4th Jun 2006 05:50 AM
Calculating a future date from an existing date in a query KlausAlt Microsoft Access 3 5th Apr 2006 12:38 AM
Calculating Difference Between Start Date & Time And End Date & Ti =?Utf-8?B?U2Ftd2Fy?= Microsoft Excel Misc 2 19th Dec 2005 12:42 PM
Calculating recurring date in following month, calculating # days in that period Walterius Microsoft Excel Worksheet Functions 6 4th Jun 2005 11:21 PM
Calculating days between current date and a date in future NETWORKDAYS() function Faheem Khan Microsoft Excel Worksheet Functions 2 10th Feb 2005 07:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:47 AM.