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
|
|||
|
|||
lookup and calculate
I have a separate table that has the state code, the month, and day
ex. state timeframe(months) addl days Alabama 4 0 Colorado 7 30 In my form if the state = Alabama then I need to Calulate a date field and add the timeframe and additional days Ex. 07/12/2004 (if state = Colorado, then add the timeframe (7) and the additional days (30) to equal 03/14/2005 Can you tell me how to accomplish this? |
#2
|
|||
|
|||
NewDate = DateSerial(Year(OrigDate),
Month(OrigDate)+Dlookup("[Timeframe]","StateTable","[State] = '" & StateValue & '"), Day(OrigDate) + DLookup("[AddlDays]","StateTable","[State] = '" & StateValue & '")) Whe OrigDate is your "starting" Date Table called StateTable contains the fields State, Timeframe and AddlDays StateValue is the name of the state you want to look up If OrigDate = 7/12/2004 and StateValue = "Colorado" then NewDate = DateSerial(Year(OrigDate), Month(OrigDate)+7, Day(OrigDate) + 30) NewDate = 3/14/2005 HTH, -- George Nicholson Remove 'Junk' from return address. "dchristo" wrote in message ... I have a separate table that has the state code, the month, and day ex. state timeframe(months) addl days Alabama 4 0 Colorado 7 30 In my form if the state = Alabama then I need to Calulate a date field and add the timeframe and additional days Ex. 07/12/2004 (if state = Colorado, then add the timeframe (7) and the additional days (30) to equal 03/14/2005 Can you tell me how to accomplish this? |
#3
|
|||
|
|||
You just need the DateAdd function:
Add the Months: CurrentDate = DateAdd("m",[timeframe],CurrentDate) Add the Days: CurrentDate = DateAdd("d",[addl days],CurrentDate) "dchristo" wrote: I have a separate table that has the state code, the month, and day ex. state timeframe(months) addl days Alabama 4 0 Colorado 7 30 In my form if the state = Alabama then I need to Calulate a date field and add the timeframe and additional days Ex. 07/12/2004 (if state = Colorado, then add the timeframe (7) and the additional days (30) to equal 03/14/2005 Can you tell me how to accomplish this? |
#4
|
|||
|
|||
the State is in the Part A table and needs to equal the state in the DD
Timeframe table ex. if [Part A]![State] = [dda timeframe].[state], then add the timeframe and the additional days "George Nicholson" wrote: NewDate = DateSerial(Year(OrigDate), Month(OrigDate)+Dlookup("[Timeframe]","StateTable","[State] = '" & StateValue & '"), Day(OrigDate) + DLookup("[AddlDays]","StateTable","[State] = '" & StateValue & '")) Whe OrigDate is your "starting" Date Table called StateTable contains the fields State, Timeframe and AddlDays StateValue is the name of the state you want to look up If OrigDate = 7/12/2004 and StateValue = "Colorado" then NewDate = DateSerial(Year(OrigDate), Month(OrigDate)+7, Day(OrigDate) + 30) NewDate = 3/14/2005 HTH, -- George Nicholson Remove 'Junk' from return address. "dchristo" wrote in message ... I have a separate table that has the state code, the month, and day ex. state timeframe(months) addl days Alabama 4 0 Colorado 7 30 In my form if the state = Alabama then I need to Calulate a date field and add the timeframe and additional days Ex. 07/12/2004 (if state = Colorado, then add the timeframe (7) and the additional days (30) to equal 03/14/2005 Can you tell me how to accomplish this? |
#5
|
|||
|
|||
But, how do I get the state , the state code in my form comes from Table
"Part A" and needs to equal the state in Table "DD Timeframe" and from there get the timeframe and the addldays ex. [Part A].[state] = [DD Timeframe].[state], then add the timeframe and the additional days "Klatuu" wrote: You just need the DateAdd function: Add the Months: CurrentDate = DateAdd("m",[timeframe],CurrentDate) Add the Days: CurrentDate = DateAdd("d",[addl days],CurrentDate) "dchristo" wrote: I have a separate table that has the state code, the month, and day ex. state timeframe(months) addl days Alabama 4 0 Colorado 7 30 In my form if the state = Alabama then I need to Calulate a date field and add the timeframe and additional days Ex. 07/12/2004 (if state = Colorado, then add the timeframe (7) and the additional days (30) to equal 03/14/2005 Can you tell me how to accomplish this? |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Multiple table lookup | KG | General Discussion | 1 | June 3rd, 2005 05:39 AM |
Formula Question... LookUP | G | General Discussion | 4 | March 7th, 2005 01:38 AM |
Lookup Functions | Sharon | Worksheet Functions | 6 | February 20th, 2005 05:04 AM |
Help with LOOKUP (golf handicaps) | Tom Ogilvy | Worksheet Functions | 19 | December 15th, 2003 11:21 PM |
Help with LOOKUP (golf handicaps) | GoLions | Worksheet Functions | 0 | December 14th, 2003 01:59 PM |