G
Greg
I have a little program that consecutively numbers the Sale_Order field
within each Species:
Private Sub SetSaleOrder_Click()
Dim i
Dim cspecies
cspecies = [Species]
i = 1
For i = 1 To 95
[Sale_Order] = i
DoCmd.RunCommand acCmdRecordsGoToNext
If [Species] <> cspecies Then
cspecies = [Species]
i = 0
End If
Next
I run this on a form: frmSetSaleOrder
which calls a query: qrySetSaleOrder
which is made from my main table: tblAnimals
I'd like to be able to stop the code when I get to the last record - so it
doesn't write new records. Any suggestions?
Ultimately, I'd like to be able to replace the 95 above (which is the
largest number for any of the species) with a variable which counts the
members of that species - but I haven't figured that out either.
Also, I'd like to not allow records to be added while this form is open.
How do I make the data updateable but prevent new records to be added?
Any help is appreciated. I've order a couple of books on VBA . . . so my
education will commence soon.
within each Species:
Private Sub SetSaleOrder_Click()
Dim i
Dim cspecies
cspecies = [Species]
i = 1
For i = 1 To 95
[Sale_Order] = i
DoCmd.RunCommand acCmdRecordsGoToNext
If [Species] <> cspecies Then
cspecies = [Species]
i = 0
End If
Next
I run this on a form: frmSetSaleOrder
which calls a query: qrySetSaleOrder
which is made from my main table: tblAnimals
I'd like to be able to stop the code when I get to the last record - so it
doesn't write new records. Any suggestions?
Ultimately, I'd like to be able to replace the 95 above (which is the
largest number for any of the species) with a variable which counts the
members of that species - but I haven't figured that out either.
Also, I'd like to not allow records to be added while this form is open.
How do I make the data updateable but prevent new records to be added?
Any help is appreciated. I've order a couple of books on VBA . . . so my
education will commence soon.