thebluffer
MIS
Novice user trying to write somewhat simple code but I can not get the program to run. I want to group records by a common "Control Number" then populate a running total for each Control Number in a field called RecordCount. Some "Control Numbers" may have 18 records and others more or less. Thanks for any help.
Private Sub FinancialRecordCount()
Dim PropertyNumber As Integer
Dim PropertyFinancialRecordCount As Integer
Dim dbs As Database, rst As Recordset
Set dbs = OpenDatabase("RECM.mdb"
Set rst = dbs.OpenRecordset("SELECT ControlNumber, RecordNumber FROM [Financial Data]"
rst.MoveFirst
PropertyNumber = ControlNumber
PropertyFinancialRecordCount = 1
Do While Not EOF()
If PropertyNumber = ControlNumber Then
RecordNumber = PropertyFinancialRecordCount
PropertyFinancialRecordCount = PropertyFinancialRecordCount + 1
rst.MoveNext
Else
PropertyNumber = ControlNumber
PropertyFinancialRecordCount = 1
End If
Loop
dbs.Close
End Sub
Private Sub FinancialRecordCount()
Dim PropertyNumber As Integer
Dim PropertyFinancialRecordCount As Integer
Dim dbs As Database, rst As Recordset
Set dbs = OpenDatabase("RECM.mdb"
Set rst = dbs.OpenRecordset("SELECT ControlNumber, RecordNumber FROM [Financial Data]"
rst.MoveFirst
PropertyNumber = ControlNumber
PropertyFinancialRecordCount = 1
Do While Not EOF()
If PropertyNumber = ControlNumber Then
RecordNumber = PropertyFinancialRecordCount
PropertyFinancialRecordCount = PropertyFinancialRecordCount + 1
rst.MoveNext
Else
PropertyNumber = ControlNumber
PropertyFinancialRecordCount = 1
End If
Loop
dbs.Close
End Sub