R
RIP
I previously asked how to autonumber using vb...
I thought more about my question - autonumbering is not really what I am
having difficulties with, but instead filtering for the specific record to
use for the autonumbering...
This is the code I am currently running to get the wallNo field to increment
based on the last number found in the table.
Private Sub Form_Current()
Dim db As DAO.Database
Dim rstWallAdd As DAO.Recordset
Set db = CurrentDb()
Set rstWallAdd = db.OpenRecordset("tblWallDetail", dbOpenTable)
rstWallAdd.Index = "primarykey"
rstWallAdd.MoveLast
wallNo = rstWallAdd!wallNo + 1
rstWallAdd.Close
db.Close
End Sub
--------------------------------------------------
This works fine for straight autonumbering using a single field.
====================================
Heres what I want to do...
The "tblWallDetail" has the following fields/indexes of relevance.
estnum - (indexed=yes duplicates ok)
wallNo - (indexed=yes duplicates ok)
How can I filter for all the records in the "tblWallDetail" table that have
a particular "estnum" value, and then filter for the last "wallNo" record in
that particular recordset. Does that make sense??
I want to get the last number from the "wallNo" field in the "tblWallDetail"
table that have the same "estnum" value.
In other words, the estimate number ('"estnum") will continue to repeat as
long as we are adding records for that estimate, But the wall number
("wallNo") will increment by one as needed.
Thanks in advance for all your help.
I thought more about my question - autonumbering is not really what I am
having difficulties with, but instead filtering for the specific record to
use for the autonumbering...
This is the code I am currently running to get the wallNo field to increment
based on the last number found in the table.
Private Sub Form_Current()
Dim db As DAO.Database
Dim rstWallAdd As DAO.Recordset
Set db = CurrentDb()
Set rstWallAdd = db.OpenRecordset("tblWallDetail", dbOpenTable)
rstWallAdd.Index = "primarykey"
rstWallAdd.MoveLast
wallNo = rstWallAdd!wallNo + 1
rstWallAdd.Close
db.Close
End Sub
--------------------------------------------------
This works fine for straight autonumbering using a single field.
====================================
Heres what I want to do...
The "tblWallDetail" has the following fields/indexes of relevance.
estnum - (indexed=yes duplicates ok)
wallNo - (indexed=yes duplicates ok)
How can I filter for all the records in the "tblWallDetail" table that have
a particular "estnum" value, and then filter for the last "wallNo" record in
that particular recordset. Does that make sense??
I want to get the last number from the "wallNo" field in the "tblWallDetail"
table that have the same "estnum" value.
In other words, the estimate number ('"estnum") will continue to repeat as
long as we are adding records for that estimate, But the wall number
("wallNo") will increment by one as needed.
Thanks in advance for all your help.