DataBase - Date Add Function on Forms
Asked By Mike
04-Feb-10 09:32 AM
I am using access to help with workflow operations.
I have a date field called "Fom 16 Signed" which is self explanatory.
I then have a field called "Form 17 Due" This is due within 7 days of the
above Form 16 being signed, so in access I want to create a date based on the
date in an exiting field + 7 days. Dead easy in excel, but cant get round it
in access.
In the default value I have typed;
DateAdd("d","7","[Date Form 16 Signed]") but keep getting syntax errors.
I am at my wits end, until somone mentioned these forums, so here goes.
i hope you can help.
Fom
(1)
Somone
(1)
Days
(1)
Wits
(1)
Daryl S replied to Mike
Mike -
In the AfterUpdate event of the Form 16 Signed control, add this code:
Me.[Form 17 Due] = DateAdd("d",7,Me.[Date Form 16 Signed])
Every time the control Form 16 Signed is changed, the Form 17 Due will be
updated as well.
If you only want it updated if Form 17 Due is null, then use this:
If Me.[Form 17 Due] Is Null Then
Me.[Form 17 Due] = DateAdd("d",7,Me.[Date Form 16 Signed])
End If
--
Daryl S
r181_365 , coalesce(max(r4), 'N') as r366_730 from ( select case when filing_date < = current date - 0 DAYS and filing_date > = current date - 90 DAYS then 'Y' end as r1 , case when filing_date < = current date - 91 DAYS and filing_date > = current date - 180 DAYS then 'Y' end as r2 , case when filing_date < = current date - 181 DAYS and filing_date > = current date - 365 DAYS then 'Y' end as r3 , case when filing_date < = current date - 366 DAYS then 'Y' end as r4 from ( select filing_date from sarfiling where cust_nbr = ? and filing_date > = current date - 730 days ) as t ); This returns a row with the four columns set to either 'Y' or
hiye Lost the plot on this one. . . . . I need to calculate, medication divided by bed days per month. I have created a query with expr's, the first expr calculates the medication total / bed days total per month. Then i created an expr to add all these monthly together. I see where i am coming from? SELECT [A&E 2011 / 12].Apr, [A&E Bed Days 2011 / 12].April, [A&E 2011 / 12.Apr] / [A&E Bed Days 2011 / 12.April] AS Expr1, [A&E 2011 / 12].May, [A&E Bed Days 2011 / 12].May, [A&E 2011 / 12.May] / [A&E Bed Days 2011 / 12.May] AS Expr2, [A&E 2011 / 12].Jun, [A&E Bed Days 2011 / 12].June, [A&E 2011 / 12.Jun] / [A&E Bed Days 2011 / 12.June] AS Expr3, [A&E 2011 / 12].Jul, [A&E Bed Days 2011
wouldn???t necessarily be today???s date, but a date the user chooses, minus 21-days (assuming 21 days in a trading month), 63-days, 125-days, and 250-days (assuming there are 260-days in a trading year, minus 9 holidays). How can I incorporate this logic into my a TextBox, and pass this to the Query to get a 1-month return (21 days), 3-month (63-days), 6-month (125-days), and 1-year (250-days)? Thanks everyone!! Ryan- - - - Ryan- -- If this
ECG.luBillingCity, ECG.BillingState, ECG.luBillingZip, ECG.StartDate, ECG.TodayDate, DateDiff("d", [StartDate], [TodayDate]) AS Days, ECG.Hours, ECG.Tuition, Switch([Days]> = 365 And [Days]<730, 0.05, [Days]> = 730 And [Days]<1095, 0.1, [Days]> = 1095 And [Days]<1460, 0.15, [Days]> = 1460 And [Days]<1825, 0.2, [Days]> = 1825 And [Days]<2190, 0.25, [Days]> = 2190
March to October Names of people are Fred Tom Fred will use the caravan 30 days a year Tom will use it 8 days a year These could be more or less days The rest of the time would be empty. So Fred would have to pay more Fred Tom Fred (1) Part (1) Database (1) Tom Hope (1) Total cost (1) Total days = Fred's Days + Tom's Days Fred's Part of Total Cost = Total Cost x (Fred's Days / Total Days) Tom's Part of Total Cost = Total Cost x (Tom's Days / Total Days) Is