Avatar billede smidten Praktikant
16. juni 2011 - 15:11 Der er 10 kommentarer

dato problemer i access

er lidt en klaphat til access, men håber i kan hjælpe og forstår mit problem. Har lavet an database med tilhørende formular. Kan dog ikke finde ud af at gøre det umuligt at dobbeltbooke ved booking af flere datoer, nogen der kan hjælpe?
Avatar billede terry Ekspert
16. juni 2011 - 19:08 #1
Depending on your table design you could include the date field as part of a Compound key http://en.wikipedia.org/wiki/Compound_key
Avatar billede terry Ekspert
16. juni 2011 - 19:14 #2
If thats not possible then I think you will need to explain why you need to have a unique date field.

I can imagine that the booking table is related to some other table through a foreign key field, you can combin ethis field and the date field as the Compound key
Avatar billede smidten Praktikant
17. juni 2011 - 10:12 #3
thank you terry, what I mean is, that i want to rent a bike out from a number of bikes in a given period. Then I have made a table consisting id, rent date and return date, but I can't seem to find out how to make it impossible to book the same bike in a given period, for example make it impossible to rent the bike out from july 2nd until july 14th, and then again from july 4th until july 10th.

hope that explains my problem

john
Avatar billede neoman Novice
17. juni 2011 - 10:15 #4
Avatar billede terry Ekspert
17. juni 2011 - 18:56 #5
Hi John
That explains things and using a compound key isnt going to help.

Take a look at the link neoman referes to, this explains your problem very well. There are a number of ways you can check if a bike is available for a given period but it all depends on how you design your forms.

Lets say that a customer wanted to rent a bike (any bike) for a given period. You could have a form where you entered the start data and end date and then select all the bkes which were not booked within that period.
So looking at the example in the link and the period entered is ithe desired dates, you would actually want the two "bikes" where there is no period start or period end within that interval.
Avatar billede smidten Praktikant
20. juni 2011 - 15:09 #6
okay now I found part of a solution, but need a bit of code to end the program. I need to find out how to go from one form to another where when you go to the second form, it performs a check up if a checkbox is marked in the selected period. Is it clear what I mean, or total nonsense :-)
Avatar billede terry Ekspert
20. juni 2011 - 18:18 #7
"I need to find out how to go from one form to another where when you go to the second form, it performs a check up if a checkbox is marked in the selected period"

Total nonsense :o)

No its not nonsense but I think a bit more information might help.

If a checkbox is markt for a given period on another (second) form then I would assume that the data for that form is also in a tabel, so why do you need to go to a form, which might not even be open?
Avatar billede smidten Praktikant
21. juni 2011 - 09:43 #8
Has come a bit furher, but has run into another problem, do anyone know how to make a search function on two dates? I have a startdate and endDate, and would like to get all records shown that are in that period. Can anyone help?
Avatar billede terry Ekspert
21. juni 2011 - 18:42 #9
The link given earlier should help you answer that question

http://www.baldyweb.com/OverLap.htm
Avatar billede terry Ekspert
09. januar 2012 - 16:53 #10
could we close here please?
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



IT-JOB

Cognizant Technology Solutions Denmark ApS

Data Architect

Cognizant Technology Solutions Denmark ApS

Sr. Test Analyst