Avatar billede Slettet bruger
16. november 2004 - 19:56 Der er 9 kommentarer og
1 løsning

Rapport og nummering1

Hej

I en Access db har jeg lavet en foresprøgsel. Denne forespørgsel indeholder en række felter, bla. kundenummer. Til hvert kundenummer, knytter sig 5-10 rækker i forespørgselen.

Spørgsmålet er nu: Kan jeg få access til at skrive nummer 1/5 i den første række, nummer 2/5 i den anden, nummer 3/5... Og hvis der f.eks. knytter sig 10 rækker til et kundenummer, skal den naturligvis skrive 1/10, 2/10 osv.

Formen behøver ikke at være lige sådan, men må også gerne være to kolonner, en med det samlet antal rækker og en med denne kundes række nummer?

Håber at det kan løses simpelt - på forhånd tak.
Avatar billede terry Ekspert
16. november 2004 - 20:04 #1
"Håber at det kan løses simpelt"!
Sorry, I dont think ít can!
Avatar billede terry Ekspert
16. november 2004 - 20:05 #2
but that doesnt mean it can not be solved
Avatar billede Slettet bruger
16. november 2004 - 22:15 #3
Kan du evt. ridse op hvordan det kunne løses?
Avatar billede terry Ekspert
17. november 2004 - 08:44 #4
I think you will need to make a function To do this. Then you have three variables at the top of the forms module, so that they are static . One for holding the Kundenummer, one for holding the row number (1....10) and another for holding the number of rows for that kunde.

You will need to call the function with one (I think) paramater, the kundenummer. Then test to see if the kundenummer you send to the function is the same as the one in the static variable.
If it is NOT the same then you need to use for example DCount() to get the number of records for this kunde and put it in the variable. You could make a copy of the forms recordset and loop through that counting them too.

So now you have the max rows for that kunde, and you still need the row number. At the same time as you test that the kundenummer you come with is NOT the same as the static variable, then you set the variable containing the row to 0.
Then you just add one to it for each row.

Then its just a case of returning these values in a string
EXAMPLE:
GetKundeRowNum = iRow & "/" & iMaxRow
In the function you will need to test if the
Avatar billede terry Ekspert
17. november 2004 - 08:44 #5
cant be far out :o)
Avatar billede terry Ekspert
17. november 2004 - 08:48 #6
Oh, forgot to mention!
On the form you have an unbound field where the control source is set to call the function

=GetKundeRowNum([Kundenummer])
Avatar billede Slettet bruger
22. november 2004 - 23:26 #7
Hej
Da jeg ikke får tid til at kigge mere på det lige nu, vil det så være mest rimligt at du får point nu, og så må jeg spørge igen, hvis jeg løber ind i problemer?
Avatar billede terry Ekspert
23. november 2004 - 18:39 #8
Well I prefer closing the question as soon as possible, but I'm sure if you look at my karam that others have a different opinion :o)
If you think you have received help which justifies giving the points then I think you should close, if not then let it stay open until you do.

From my experience this isnt a quextion which has a streighforward answer, otherwise I would have given it. There are a number of problems involved in finding a workable solution, and thats why I just gave an idea as to how it might be done, although no guaranties. So in the end it may take hours to get it working correctly!
Avatar billede Slettet bruger
24. november 2004 - 10:55 #9
OK. Takker.
Avatar billede terry Ekspert
24. november 2004 - 11:58 #10
selv 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