number rows based on value of a field

lala

Registered User.
Local time
Today, 18:40
Joined
Mar 20, 2002
Messages
741
hi, how do i add numbers to row in the following manner:

if 4 rows have the same number then one of them should be 0 and the rest 1, same for all others.

basically, the code should look at the value in the table, if it's the same as the row before add 1, if not - 0 (i think i got the logic right).



Numbers In My Table Numbers To Add
2 0
2 1
2 1
2 1
4 0
4 1
17 0
17 1
17 1
17 1
18 0
18 1
55 0
55 1


thank you!!!
 
Hello lala!
Look at "DemoNumberRowsA2000.mdb" (attachment, zip).
Open Form1 and try.
Look at VBA, but if you delete a record 4.0 the next record
will be 4.3. Adapt it as you need.
 

Attachments

thank you so much!!!!!!!, this is perfect. this does even more than i need so you're saving me future questions as well

thank you))))))))))))
 
I'm just wondering if your question is actually answered? I looked at the demo and it's not doing what you explained that you wanted.
 
No, it does something more I thought, it actually numbers them. I haven't used it yet but I tested it and it looks fine.

Am I wrong in thinking that I will just replace numbers that are not 0 with 1.
 
Last edited:
If all you wanted to do was number the rows according to your spec, did you consider using a report?
 
i don't need the row numbers, what i'm doing is writing a procedure that will upload invoices to QB. QB tables are not easy to work with (jmo), too many weird limitations (jmo again)

so for invoices, if i want to create an invoice with multiplle line numbers i have to upload invoice lines with 1 and the last line has to be 0, that way it knows that this is all part of the invoice.

after i posted, i realized how to do it with a few queries but when i tried posting a reply here saying that i don't need this anymore my IE kept crashing and deleting my posts, so i gave up and then MStef replied
 
With things like this it's easier to manipulate it in a report than in a query.

Well, since you don't need it anymore I need not worry. :)
 
You meant using a report to get the numbers and then do whatever I need?
How? Just wondering.

Also, soon after I posted I did it by using a few make table queries.

And you do help me a lot so thank you very much for that.)))))))))))))
And I will be back with more problems soon: finishing up a program and I left everything I didn't know how to do for last
 
If you needed the number for presentation in a report, you will need code. Set it to 0 in the Format event of Group's Header section, and set it to 1 in the Detail section's Format event.

Good luck with the rest of your project :)
 
Got it, no, that's not my case, I need them in the tabke or a query so I can export it.

And thank you for the luck, most of it will come from AWF))))))))
 

Users who are viewing this thread

Back
Top Bottom