ejvitor
Member
How to auto generate once i click the add button actually autonum sub procedure is a part of add button click event here's my code for auto-increment below:
Sub autonum()
Dim cnSet As New ADODB.Connection
Dim rsSet As New ADODB.Recordset
Dim nums As Integer
Call connection(cnSet, Application.StartupPath & "\dbsi.mdb")
Call recordset(rsSet, cnSet, "SELECT * FROM t_Customers")
If rsSet.RecordCount = 0 Then
Me.txtCustomerNo.Text = "CUST-001"
Else
rsSet.MoveLast()
Me.txtCustomerNo.Text = "CUST-" & Format(Val(nums) + 1, "000#")
End If
End Sub
any help?
Sub autonum()
Dim cnSet As New ADODB.Connection
Dim rsSet As New ADODB.Recordset
Dim nums As Integer
Call connection(cnSet, Application.StartupPath & "\dbsi.mdb")
Call recordset(rsSet, cnSet, "SELECT * FROM t_Customers")
If rsSet.RecordCount = 0 Then
Me.txtCustomerNo.Text = "CUST-001"
Else
rsSet.MoveLast()
Me.txtCustomerNo.Text = "CUST-" & Format(Val(nums) + 1, "000#")
End If
End Sub
any help?