Hi. I am making an application in VB as frontend; backend is Oracle . I want autogenerated ID on click of "New" button. It works well if data is present in the table, but shows error if the table is empty. What i need to insert so that it work when I am using the appliction for the first time? My button code is as follows:
Private Sub cmd_new_Click()
Call txt_clear
txt_name.Enabled = True
Set rsCat = New ADODB.Recordset
rsCat.Open "Category", conn, adOpenDynamic, adLockPessimistic
If rsCat.EOF = rscat.BOF Then
tempId = 1000
Else
rsCat.MoveLast
tempId = rsCat.Fields("Category_Id") + 1
End If
txt_Id = tempId
cmd_Save.Enabled = True
cmd_new = False
End Sub