G
Greg
I'm new to VBA.
I have a form that calls a query to SetSellOrder for my auction database.
On the form I would like a botton which will renumber the sell order. There
must be a real simple way to loop throught the database and reorder - but I
can't program it!
Here's the details:
Table: tblAnimals
Fields: Species, Entry_Order, Sale_Order, In_Auction
The query pulls the the table and puts the animals in Entry_Order sort and
limits the animals to In_Auction = Yes. This Entry_Order field sorts the
entire database into the correct sales order and is already in the database.
The Sale_Order is the order that an individual Species will sell in. So I
have:
Species Entry_Order Sale_order
Beef 1001
Beef 1002
Beef 1003
etc
Sheep 2001
Sheep 2002
Sheep 2003
Sheep 2004
etc
Rabbits 3001
Rabbits 3002
Rabbits 3003
etc
I would like to click a botton and have the Sale_Order filled in
automatically like so:
Species Entry_Order Sale_Order
Beef 1001 1
Beef 1002 2
Beef 1003 3
etc
Sheep 2001 1
Sheep 2002 2
Sheep 2003 3
Sheep 2004 4
etc
Rabbits 3001 1
Rabbits 3002 2
Rabbits 3003 3
etc
Trying to get just a little bit of code to work and progress from there, so
far I have:
Private Sub SetSaleOrder_Click()
Dim i
For i = 1 To 4
[Sale_Order] = i
i = i + 1
DoCmd.RunCommand acCmdRecordsGoToNext
Next
End Sub
I was jsut trying to see if I could get any code to work and realize this
code won't accomplish my goal. The above code updates the first 2 Sale_Order
fields with 1 and 3. I don't konw why.
Ultimately, I'd like the program to go to the top record and parse down the
whole database and renumber the Sale_Order from 1 to the count of that
Species and than start over for the next Species.
Thanks for any help.
I have a form that calls a query to SetSellOrder for my auction database.
On the form I would like a botton which will renumber the sell order. There
must be a real simple way to loop throught the database and reorder - but I
can't program it!
Here's the details:
Table: tblAnimals
Fields: Species, Entry_Order, Sale_Order, In_Auction
The query pulls the the table and puts the animals in Entry_Order sort and
limits the animals to In_Auction = Yes. This Entry_Order field sorts the
entire database into the correct sales order and is already in the database.
The Sale_Order is the order that an individual Species will sell in. So I
have:
Species Entry_Order Sale_order
Beef 1001
Beef 1002
Beef 1003
etc
Sheep 2001
Sheep 2002
Sheep 2003
Sheep 2004
etc
Rabbits 3001
Rabbits 3002
Rabbits 3003
etc
I would like to click a botton and have the Sale_Order filled in
automatically like so:
Species Entry_Order Sale_Order
Beef 1001 1
Beef 1002 2
Beef 1003 3
etc
Sheep 2001 1
Sheep 2002 2
Sheep 2003 3
Sheep 2004 4
etc
Rabbits 3001 1
Rabbits 3002 2
Rabbits 3003 3
etc
Trying to get just a little bit of code to work and progress from there, so
far I have:
Private Sub SetSaleOrder_Click()
Dim i
For i = 1 To 4
[Sale_Order] = i
i = i + 1
DoCmd.RunCommand acCmdRecordsGoToNext
Next
End Sub
I was jsut trying to see if I could get any code to work and realize this
code won't accomplish my goal. The above code updates the first 2 Sale_Order
fields with 1 and 3. I don't konw why.
Ultimately, I'd like the program to go to the top record and parse down the
whole database and renumber the Sale_Order from 1 to the count of that
Species and than start over for the next Species.
Thanks for any help.