Avatar billede Plauesgaard Nybegynder
29. november 2011 - 10:02 Der er 9 kommentarer og
1 løsning

Recordset hjælp

Jeg har en tabel som indeholder flg. felter, som danner baggrund for en kombinationsboks.

TurID
Afg.
Ugedag (tal mellem 1 og 3, da der er 3 forskellige setup hen over
ugen)
Postnr.

Eksempel
TurID    Afg.  Ugedag  Postnr
104B12  01:40  1      8200
104B12  01:40  1      8500
104B12  01:50  2      8200
105C20  02:00  2      8700
...

I min formular har jeg lavet det således, at der kun vises de TurId som hører til dagen og dublerede TurId kun vises en gang. Men jeg vil gerne give brugeren en mulighed for at se de destinationer som de forskellige TurId har. Min tanke var at oprette et felt mere i tabellen (Destination), og så få vist dette felt i kombinationsboksen.
Når jeg så opdaterer tabellen (tilføjelsesforespørgsel i VBA), så
kunne man måske, ved hjælp af recordset få tilføjet flg.
Bemærk postnumre samles i et felt, hvis turid er ens, indenfor samme ugedag.

Turid    Afg.  Ugedag  Postnr      Destination.
104B12  01:40    1        8200    8200/8500
104B12  01:40    1        8500    8200/8500
104B12  01:50    2        8200    8200
105C20  02:00    2        8700    8700
...

Jeg benytter access 2003.
Håber I kan hjælpe
Per Lauesgaard
Avatar billede terry Ekspert
29. november 2011 - 18:02 #1
"Når jeg så opdaterer tabellen (tilføjelsesforespørgsel i VBA), så kunne man måske, ved hjælp af recordset få tilføjet flg. ..."

If the table already contains the fields (postnr + Destination)

but they are empty then you only need to requery teh combo box
after you have run the append query.

Me.MyCombo.Requery
Avatar billede Plauesgaard Nybegynder
29. november 2011 - 20:08 #2
Hey Terry

What I want is to get the table field "Destination" filled with all the zip codes as the car Turid running for the selected day from the other items with the same Turid and weekday.
That is a trip ID No. 14B12 on day one two zip codes are run to see my table like this when it is imported.
Turid weekday Zipcode Dest.
14B12 1 9500
14B12 1 8300

I can get the table to look like.
Turid weekday Zipcode Dest.
14B12 1 9500 9500 / 8300
14B12 1 8300 9500 / 8300

It should be noted that the same Turid good can be found at week 2, so there should be both checked for identical Turid and weekday. Hope it makes sense.

Per
Avatar billede terry Ekspert
29. november 2011 - 22:01 #3
Why not take another approach.

Have the combo where you have
TurID    Afg.  Ugedag  Postnr

And then a listbox which shows the Destination of the selected row in the first combo
Avatar billede terry Ekspert
29. november 2011 - 22:04 #4
This example usews two related combo boxes but have one combo and one list box is very similar

http://office.microsoft.com/en-us/access-help/basing-one-combo-box-on-another-HA001173058.aspx
Avatar billede Plauesgaard Nybegynder
30. november 2011 - 15:57 #5
Hey Terry

My screen is already designed as a multi-form (1 -> M-> M) showing postcodes when you've updated the combo box. It works as it should, but my users are quite demanding and would like to be able to determine which Turid they should choose (based on the destinations) before they update the combo box, as there are many almost identical Turid, departing simultaneously. Thus, they avoid having to click back and forth until they find the right one. But instead select from the text in the destination, so they can quickly find the right one. I have often created combo boxes that are interdependent but not thought about the possibility of list box. It will, I certainly have in mind, if it failed to create a solution where one can directly see the selection box which you must choose before you choose Turid. Can you send a screen dump or should it be done by mail in this forum?

Otherwise, thank you, because you've used a little of your time on me.
I am totally new to this forum, I just click reply, because you get those points.
Sincerely
per Lauesgaard
Avatar billede terry Ekspert
30. november 2011 - 18:52 #6
"Can you send a screen dump or should it be done by mail in this forum?"

I'm not sure what it is you want me to send a screen dump of
Avatar billede Plauesgaard Nybegynder
01. december 2011 - 07:43 #7
Hi Terry

Sorry. I meant, of course, I instead of you
Per
Avatar billede terry Ekspert
01. december 2011 - 19:40 #8
You could send me your dB if you want

ekspertenATsanthell.dk
AT = @

I'll first be able to look at it on Sunday, rather busy
Avatar billede Plauesgaard Nybegynder
02. december 2011 - 20:13 #9
Hey Terry

I myself have found a solution that users are satisfied with.
A table is of course an array, but I found out to load all the items in an array, then I compared them, so that zip code would be written to the destination field, where Turid and day were similar. Then I updated samlige destinationsfleter. Just look out the solution to work, but I lack to control it completely, and import a few more times before I can say with sindro that it's okay. But I will send you a screen dump (Tuesday). Sometimes input from others, even that which makes you see things from another angle, and it may well be that it may be smart are. But initially, it was important to get it to work.
But once again thank you.
per Lauesgaard
Avatar billede terry Ekspert
04. december 2011 - 10:03 #10
great you found a solution, no need to send me a screen dump

Terry
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