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  

Adding months to a date of birth



 
 
Thread Tools Display Modes
  #1  
Old September 28th, 2007, 02:22 AM posted to microsoft.public.access.forms
[email protected][_2_]
external usenet poster
 
Posts: 42
Default Adding months to a date of birth

I am working in a form. I have a field called Visiting Date and a
field called DOB and a field called Classroom. I am trying to come up
with a formul in the Visiting date that will show if a Child's
Classroom = Bumble Bears, the visiting date needs to tell me the date
on his 15 months, when the Child's Classroom = Doodlebugs, the
visiting date needs to tell me the date on his 33 months. Can anyone
help me. I have such a hard time with IF statements. Your help is
greatly appreciated.
Thank you!

  #2  
Old September 28th, 2007, 02:23 AM posted to microsoft.public.access.forms
[email protected][_2_]
external usenet poster
 
Posts: 42
Default Adding months to a date of birth

On Sep 27, 9:22 pm, "
wrote:
I am working in a form. I have a field called Visiting Date and a
field called DOB and a field called Classroom. I am trying to come up
with a formul in the Visiting date that will show if a Child's
Classroom = Bumble Bears, the visiting date needs to tell me the date
on his 15 months, when the Child's Classroom = Doodlebugs, the
visiting date needs to tell me the date on his 33 months. Can anyone
help me. I have such a hard time with IF statements. Your help is
greatly appreciated.
Thank you!


Maybe I should be using a bound text for the Visiting date that has
the formula in it.

  #3  
Old September 28th, 2007, 03:15 AM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default Adding months to a date of birth

You could add some code to the On_Current event of your form using the
DateAdd function. Example;

Private Sub Form_Current

If Me![Classroom] = "Bumble Bears" Then

Me![Visiting Date] = DateAdd ("m", 15, Me![DOB]) ' add 15 months to DOB

ElseIf Me![Classroom] = "Doodlebugs" Then

Me![Visiting Date] = DateAdd ("m", 33, Me![DOB])

End If

End Sub

Add however many Else If's you need for the possible values of the Classroom
control. If you have a lot of possibilities, it might be slightly easier to
code using a Select Case statement rather than an If...Then statement

You may also want to call this from the After_Update of your Classroom
control to make sure it stays up to date. Example;

Private Sub Classroom After_Update

Call Form_Current

End Sub

HTH

" wrote:

I am working in a form. I have a field called Visiting Date and a
field called DOB and a field called Classroom. I am trying to come up
with a formul in the Visiting date that will show if a Child's
Classroom = Bumble Bears, the visiting date needs to tell me the date
on his 15 months, when the Child's Classroom = Doodlebugs, the
visiting date needs to tell me the date on his 33 months. Can anyone
help me. I have such a hard time with IF statements. Your help is
greatly appreciated.
Thank you!


  #4  
Old September 29th, 2007, 03:09 AM posted to microsoft.public.access.forms
[email protected][_2_]
external usenet poster
 
Posts: 42
Default Adding months to a date of birth

On Sep 27, 10:15 pm, Beetle wrote:
You could add some code to the On_Current event of your form using the
DateAdd function. Example;

Private Sub Form_Current

If Me![Classroom] = "Bumble Bears" Then

Me![Visiting Date] = DateAdd ("m", 15, Me![DOB]) ' add 15 months to DOB

ElseIf Me![Classroom] = "Doodlebugs" Then

Me![Visiting Date] = DateAdd ("m", 33, Me![DOB])

End If

End Sub

Add however many Else If's you need for the possible values of the Classroom
control. If you have a lot of possibilities, it might be slightly easier to
code using a Select Case statement rather than an If...Then statement

You may also want to call this from the After_Update of your Classroom
control to make sure it stays up to date. Example;

Private Sub Classroom After_Update

Call Form_Current

End Sub

HTH



" wrote:
I am working in a form. I have a field called Visiting Date and a
field called DOB and a field called Classroom. I am trying to come up
with a formul in the Visiting date that will show if a Child's
Classroom = Bumble Bears, the visiting date needs to tell me the date
on his 15 months, when the Child's Classroom = Doodlebugs, the
visiting date needs to tell me the date on his 33 months. Can anyone
help me. I have such a hard time with IF statements. Your help is
greatly appreciated.
Thank you!- Hide quoted text -


- Show quoted text -


Actually what I am looking for is a formula that you can add in a
bound text box. I don't know where to find an On_Current. I do not
see it in the properties of the text box. Thanks n advance.

 




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 07:42 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.