10. december 2002 - 09:51Der er
28 kommentarer og 1 løsning
Beregning af dato
Hejsa,
Jeg skal have lavet et beregnende datofelt(er).
Det skal være sådan at man indtaster en tømningsdag eks. mandag, og herefter indtaster man så Tømningsinterval, eks. 14 dages tømning (Altså hver 14. dag) og man indtaster den første gang sidste tømningsdato. Udfra disse tre kriterer skal den så beregne næste tømning, den foregående tømning skal så hedde sidst tømt.
Jeg havde forestillet mig at lave en knap der beregnede disse datoer?
its hard to give a precise answer when we can see your forms or tables, but there are a number of date functions in Access to help you with this problem and dateAdd is one of them. Also look at dateserial, datePart and maybe weekday
If you enter the first date for "tømning" then there is no need to enter if it is a Monday or whatever, Access can calculate that. So you only need the last date and interval to calculate the next date.
So if you have field containing interval and one containing last date then
Try using the functions I have given, if you cant get it to work then send the dB to eksperten@santhell.dk and I will look at it when I get home after work.
puller>you can send it to the address I gave and I will take a look later, I dont have time at the moment and I am guessing that I need to look at the whole design of your database, which isnt a five minute job. So knowone else can help then I am sorry, but you will have to wait, or see if we can getit working through eksperten. As I said previously it isnt easy when I dont have all the information so start by giving some infromation on the tables and forms and what you are trying to do exactly. As much info as possible makes it easier for us to "see" what it is your doing.
Det vi vil have er at den skal udvælge udfra sidsttømt og interval, ved at beregne disse to ting vil den nye dato være næstetømning. Udfra næste tømning skal det være sådan at man laver en forespørgsel der opdaterer de poster som man ønsker, eksempel ugevis. Så man angiver at man gerne vil opdatere alle de poster som har en dato som ligger inden for den ønskede uge, eksempelvis uge 50.
puller, I have a question! I can see that you have a table "Tømningsdag" which contains days of the week starting monday (1) to sunday(7) and also a table "TømningsInterval" which contains 7 (once a week) 14 (once every 14 days) and 30 (I am guessing, once a month). OK I have no problem calculating the next "Tømningsdato" if I use 7 or 14, but 30! How do I calculate this? Some months have 5 mondays for example!!!!
Det er kun ugeintervaller der skal bruges, det der er indtastet er kun testdata. Altså uge tømning, 14 dages tømning, 3 ugers tømning, 4 ugers tømning etc.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.