R
Rino
Greetings good people,
I am wondering if there is anyone out there that could help me get me
out of my misery.
This is a problem... I am trying to generate a unique number from the
last record in the table, for a specific field and than add 1 to it.
How can I do this.
So for example in the table called QuoteMain I have a field called
Quote_num. The last record in the field Quote_Num is 1631. The next
time I open the form a new number should be generated whch is 1632 and
when I click ok buttone that value should populated the table so the
next time I open the form the generated number is 1633 etc.
Do not ask me for any code since I am a new one to this kind of you
know what.
I actually developed this code but since filter is involved I cannot
use recordset:
Dim rst As DAO.Recordset
Dim nMaxVal As Integer
Dim n As Integer
nMaxVal = 1630
Set rst = Me.RecordsetClone
If Not rst.BOF Then
rst.MoveFirst
End If
Do While Not rst.EOF
n = rst![Quote_Num]
If n > nMaxVal Then
nMaxVal = n
End If
rst.MoveNext
Loop
Me![Quote_Num] = nMaxVal + 1
For God's sake please help!!!
Thanks in advance
-Rino
I am wondering if there is anyone out there that could help me get me
out of my misery.
This is a problem... I am trying to generate a unique number from the
last record in the table, for a specific field and than add 1 to it.
How can I do this.
So for example in the table called QuoteMain I have a field called
Quote_num. The last record in the field Quote_Num is 1631. The next
time I open the form a new number should be generated whch is 1632 and
when I click ok buttone that value should populated the table so the
next time I open the form the generated number is 1633 etc.
Do not ask me for any code since I am a new one to this kind of you
know what.
I actually developed this code but since filter is involved I cannot
use recordset:
Dim rst As DAO.Recordset
Dim nMaxVal As Integer
Dim n As Integer
nMaxVal = 1630
Set rst = Me.RecordsetClone
If Not rst.BOF Then
rst.MoveFirst
End If
Do While Not rst.EOF
n = rst![Quote_Num]
If n > nMaxVal Then
nMaxVal = n
End If
rst.MoveNext
Loop
Me![Quote_Num] = nMaxVal + 1
For God's sake please help!!!
Thanks in advance
-Rino