Code:
Set ww = Application.WorksheetFunction
ThisWorkbook.Activate
Dim old_name, new_name
old_name = Me.ComboBox1.Value
new_name = Me.TextBox1.Value
fda = ww.CountIf(Sheet2.Range("b2:b2000"), old_name)
If fda <= 0 Then: MsgBox "The invoice type is not found in the database. Please enter serial number " & TextBox1.Text & "1"
: UserForm1.TextBox1 = 1
Exit Sub
UserForm1.TextBox1 = 1
There is a combobox list that contains transactions based on the type of invoice, such as disbursement / purchase / sale / return / first period balance / and outgoing.
Each invoice transaction has a custom serial code according to the type of invoice, but in the database there is no outgoing invoice transaction. When I want to start with the first transaction, the transaction code serial number (1) is added after the query message msgbox.