Avatar billede puller Nybegynder
10. december 2002 - 09:51 Der 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?
Avatar billede terry Ekspert
10. december 2002 - 10:10 #1
use dateadd("d", 14, TheDateField) to add 14 days to a date
Avatar billede terry Ekspert
10. december 2002 - 10:16 #2
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
Avatar billede puller Nybegynder
10. december 2002 - 10:18 #3
I can send you the database
Avatar billede terry Ekspert
10. december 2002 - 10:20 #4
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

NextDate = dateadd("d", Interval, LastDate)
Avatar billede terry Ekspert
10. december 2002 - 10:28 #5
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.
Avatar billede puller Nybegynder
10. december 2002 - 10:54 #6
I have a problem, the data is not coming from the same table.
Avatar billede puller Nybegynder
10. december 2002 - 10:55 #7
Og dataene skal jo tilføjes de eksisterende tabeller/poster
Avatar billede terry Ekspert
10. december 2002 - 11:08 #8
puller do you have any forms made to enter this data or do you need to start from scratch?
Avatar billede puller Nybegynder
10. december 2002 - 11:08 #9
It does not work, I thin have problems with the data from the other tables
Avatar billede puller Nybegynder
10. december 2002 - 11:09 #10
I have a form, but how do I get the data to the form
Avatar billede terry Ekspert
10. december 2002 - 11:25 #11
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.
Avatar billede terry Ekspert
10. december 2002 - 11:26 #12
and Danish is fine as long as you can understand me :o)
Avatar billede terry Ekspert
10. december 2002 - 15:38 #13
puller>I am home now, so I can take a look if you send your dB
Avatar billede terry Ekspert
11. december 2002 - 09:53 #14
puller>hows it going here?
Avatar billede terry Ekspert
11. december 2002 - 15:27 #15
puller>how can you expect us to help if you cant respond?
Avatar billede puller Nybegynder
11. december 2002 - 15:30 #16
Sorry,

But I'am very busy at the moment.

Can I write in danish?
Avatar billede terry Ekspert
11. december 2002 - 15:38 #17
Yes, I have no problem with Danish
Avatar billede puller Nybegynder
11. december 2002 - 15:47 #18
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.
Avatar billede terry Ekspert
11. december 2002 - 16:11 #19
I think it best if you send the dB then I can see exactly what the problem is and make some suggestions.
eksperten@santhell.dk
Avatar billede terry Ekspert
11. december 2002 - 16:12 #20
please ZIP or re-name to .txt or XP will reject it
Avatar billede terry Ekspert
12. december 2002 - 09:04 #21
puller, did you get my mail? I need a user/password!
Avatar billede puller Nybegynder
12. december 2002 - 09:16 #22
user -> mm
password -> puller
Avatar billede terry Ekspert
12. december 2002 - 11:00 #23
ok
Avatar billede terry Ekspert
12. december 2002 - 14:28 #24
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!!!!
Avatar billede puller Nybegynder
12. december 2002 - 14:34 #25
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.
Avatar billede terry Ekspert
12. december 2002 - 14:42 #26
Ok, then there is no problem then. Back soon :o)
Avatar billede terry Ekspert
13. december 2002 - 09:26 #27
Hi puller>Have you looked at what I sent?
Avatar billede puller Nybegynder
13. december 2002 - 23:37 #28
Ja, det var fantastisk præcis hvad jeg eftersøgt. Mange tak.
Avatar billede terry Ekspert
14. december 2002 - 09:44 #29
slev tak :o)
Avatar billede Ny bruger Nybegynder

Din løsning...

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.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester