|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Hi all, When I enter 65 in totalday's field for month 3 I'd like 65 distributed 30,30 and 5 for month 3,2 and 1. formula is so: (65=30+30+5) Fields: name month totalday workday Records: jack 1 5 jack 2 30 jack 3 65 30 would you please help me?
|
|
UPDATE tblNoNameGiven SET Workday = IIf([Month]=1, 5, 30) WHERE [name]="Jack" AND [Month] Between 1 and 3;
BTW: you didn't give us any specifications for your distribution. Also name and month are poor field names since one is a property of every object and the other is a function name.
-- Duane Hookom MS Access MVP
"aminihojat" <aminihojat[ at ]discussions.microsoft.com> wrote in message news:D1533C90-91A9-4228-8245-06CE1634106A[ at ]microsoft.com...
[Quoted Text] > Hi all, > When I enter 65 in totalday's field for month 3 I'd like 65 distributed > 30,30 and 5 for month 3,2 and 1. formula is so: (65=30+30+5) > Fields: name month totalday workday > Records: jack 1 5 > jack 2 30 > jack 3 65 30 > would you please help me? >
|
|
thanks Duane Hookom your response was helpful but if I wanted to enter 65 in month 4 I'd like these results:30 for month 4 , 30 for month 3 and 5 for month 2 . but not 5 for month 1
"Duane Hookom" wrote:
[Quoted Text] > UPDATE tblNoNameGiven > SET Workday = IIf([Month]=1, 5, 30) > WHERE [name]="Jack" AND [Month] Between 1 and 3; > > BTW: you didn't give us any specifications for your distribution. Also name > and month are poor field names since one is a property of every object and > the other is a function name. > > -- > Duane Hookom > MS Access MVP > > "aminihojat" <aminihojat[ at ]discussions.microsoft.com> wrote in message > news:D1533C90-91A9-4228-8245-06CE1634106A[ at ]microsoft.com... > > Hi all, > > When I enter 65 in totalday's field for month 3 I'd like 65 distributed > > 30,30 and 5 for month 3,2 and 1. formula is so: (65=30+30+5) > > Fields: name month totalday workday > > Records: jack 1 5 > > jack 2 30 > > jack 3 65 30 > > would you please help me? > > > > >
|
|
You are getting a little less vague. Do you always enter 65? Why divide the values as you stated? Why not 20, 40, 5?
You apparently know your logic but are making this a puzzle for the rest of us. -- Duane Hookom MS Access MVP
"aminihojat" <aminihojat[ at ]discussions.microsoft.com> wrote in message news:FE96ED3D-79FC-4B56-86F7-5DDECA94D30C[ at ]microsoft.com...
[Quoted Text] > thanks Duane Hookom > your response was helpful but if I wanted to enter 65 in month 4 I'd like > these results:30 for month 4 , 30 for month 3 and 5 for month 2 . > but not 5 for month 1 > > > "Duane Hookom" wrote: > >> UPDATE tblNoNameGiven >> SET Workday = IIf([Month]=1, 5, 30) >> WHERE [name]="Jack" AND [Month] Between 1 and 3; >> >> BTW: you didn't give us any specifications for your distribution. Also >> name >> and month are poor field names since one is a property of every object >> and >> the other is a function name. >> >> -- >> Duane Hookom >> MS Access MVP >> >> "aminihojat" <aminihojat[ at ]discussions.microsoft.com> wrote in message >> news:D1533C90-91A9-4228-8245-06CE1634106A[ at ]microsoft.com... >> > Hi all, >> > When I enter 65 in totalday's field for month 3 I'd like 65 distributed >> > 30,30 and 5 for month 3,2 and 1. formula is so: (65=30+30+5) >> > Fields: name month totalday workday >> > Records: jack 1 5 >> > jack 2 30 >> > jack 3 65 30 >> > would you please help me? >> > >> >> >>
|
|
Dear Duane Hookom If my problem is vague please excuse me. I'm a beginner and I can write English a little. Suppose we have 12 months a year and each year has only 30 days. For example a worker until month 8 has worked for 170 days and I'd like to calculate 5 months(150=5*30 days) and 20 days salary for him.(170=5*30+20) Month 8 30 day Month 7 30 day Month 6 30 day Month 5 30 day Month 4 30 day Month 3 20 day Is there a VBA code or query for this problem?
"Duane Hookom" wrote:
[Quoted Text] > You are getting a little less vague. Do you always enter 65? Why divide the > values as you stated? Why not 20, 40, 5? > > You apparently know your logic but are making this a puzzle for the rest of > us. > -- > Duane Hookom > MS Access MVP > > "aminihojat" <aminihojat[ at ]discussions.microsoft.com> wrote in message > news:FE96ED3D-79FC-4B56-86F7-5DDECA94D30C[ at ]microsoft.com... > > thanks Duane Hookom > > your response was helpful but if I wanted to enter 65 in month 4 I'd like > > these results:30 for month 4 , 30 for month 3 and 5 for month 2 . > > but not 5 for month 1 > > > > > > "Duane Hookom" wrote: > > > >> UPDATE tblNoNameGiven > >> SET Workday = IIf([Month]=1, 5, 30) > >> WHERE [name]="Jack" AND [Month] Between 1 and 3; > >> > >> BTW: you didn't give us any specifications for your distribution. Also > >> name > >> and month are poor field names since one is a property of every object > >> and > >> the other is a function name. > >> > >> -- > >> Duane Hookom > >> MS Access MVP > >> > >> "aminihojat" <aminihojat[ at ]discussions.microsoft.com> wrote in message > >> news:D1533C90-91A9-4228-8245-06CE1634106A[ at ]microsoft.com... > >> > Hi all, > >> > When I enter 65 in totalday's field for month 3 I'd like 65 distributed > >> > 30,30 and 5 for month 3,2 and 1. formula is so: (65=30+30+5) > >> > Fields: name month totalday workday > >> > Records: jack 1 5 > >> > jack 2 30 > >> > jack 3 65 30 > >> > would you please help me? > >> > > >> > >> > >> > > >
|
|
I would create a table of dates "tblDates" with a single date field "theDate". Enter all the dates from the entire range you will ever need. You can then create a query that limits the returned records to a range of from the start date to the current date.
Where is other information stored such as the start date or days worked or whatever? -- Duane Hookom MS Access MVP
"aminihojat" <aminihojat[ at ]discussions.microsoft.com> wrote in message news:2F68DEBE-EA4B-41A0-B5A3-F261DB6E6C60[ at ]microsoft.com...
[Quoted Text] > Dear Duane Hookom > If my problem is vague please excuse me. I'm a beginner and I can write > English a little. Suppose we have 12 months a year and each year has only > 30 > days. > For example a worker until month 8 has worked for 170 days and I'd like to > calculate 5 months(150=5*30 days) and 20 days salary for him.(170=5*30+20) > Month 8 30 day > Month 7 30 day > Month 6 30 day > Month 5 30 day > Month 4 30 day > Month 3 20 day > Is there a VBA code or query for this problem? > > > "Duane Hookom" wrote: > >> You are getting a little less vague. Do you always enter 65? Why divide >> the >> values as you stated? Why not 20, 40, 5? >> >> You apparently know your logic but are making this a puzzle for the rest >> of >> us. >> -- >> Duane Hookom >> MS Access MVP >> >> "aminihojat" <aminihojat[ at ]discussions.microsoft.com> wrote in message >> news:FE96ED3D-79FC-4B56-86F7-5DDECA94D30C[ at ]microsoft.com... >> > thanks Duane Hookom >> > your response was helpful but if I wanted to enter 65 in month 4 I'd >> > like >> > these results:30 for month 4 , 30 for month 3 and 5 for month 2 . >> > but not 5 for month 1 >> > >> > >> > "Duane Hookom" wrote: >> > >> >> UPDATE tblNoNameGiven >> >> SET Workday = IIf([Month]=1, 5, 30) >> >> WHERE [name]="Jack" AND [Month] Between 1 and 3; >> >> >> >> BTW: you didn't give us any specifications for your distribution. Also >> >> name >> >> and month are poor field names since one is a property of every object >> >> and >> >> the other is a function name. >> >> >> >> -- >> >> Duane Hookom >> >> MS Access MVP >> >> >> >> "aminihojat" <aminihojat[ at ]discussions.microsoft.com> wrote in message >> >> news:D1533C90-91A9-4228-8245-06CE1634106A[ at ]microsoft.com... >> >> > Hi all, >> >> > When I enter 65 in totalday's field for month 3 I'd like 65 >> >> > distributed >> >> > 30,30 and 5 for month 3,2 and 1. formula is so: (65=30+30+5) >> >> > Fields: name month totalday workday >> >> > Records: jack 1 5 >> >> > jack 2 30 >> >> > jack 3 65 30 >> >> > would you please help me? >> >> > >> >> >> >> >> >> >> >> >>
|
|
|