THis is my first vb project so bear with me please. I am creating a simple database with a vb 6 front end. I am trying to track and assign id tags to equipment. I can get the primary recordset to save the main record, however this bit of code which should update the id tags is not working. I am receiving the following error: Run-time error '3001' Arguments are of the wrong type, ,are out of range, or are in conflict with one another. Any ideas would be wonderful. The table that needs to be updated has the following fields:
Number <autonumber>
Category <text>
Description <text>
CategoryTagPrefix <text>
LastTagNumber <Number>
NextTagNumber <Number>
The debugger is highlighting the code:
adoAssignID.Update sql
________________________________________
Thanks in advance for your help.
Andrea
Number <autonumber>
Category <text>
Description <text>
CategoryTagPrefix <text>
LastTagNumber <Number>
NextTagNumber <Number>
The debugger is highlighting the code:
adoAssignID.Update sql
________________________________________
Code:
Private Sub cboCategory_Click()
Dim intUserResponse As Integer
'Dim adoAssignID As Recordset
Dim sql, aLast, aNext, Name As String
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDASQL;dsn=Inventory;uid=sa;pwd=;"
sql = "Select * from zAssetCategories Order by Category"
Set adoAssignID = New Recordset
Name = cboCategory
'search for record
adoAssignID.Open sql, db, adOpenStatic, adLockOptimistic
adoAssignID.MoveFirst
adoAssignID.Find "Category = '" & Name & "'", , adSearchForward, adBookmarkFirst
txtFields(0) = Trim(adoAssignID![CategoryTagPrefix] & Str(adoAssignID![NextTagNumber]))
aLast = (adoAssignID!NextTagNumber)
aNext = (adoAssignID!NextTagNumber + 1)
sql = "Update zAssetCategories LastTagNumber = '" & (Val(aLast)) & "'"
sql = sql & ",NextTagNumber = '" & (Val(aNext)) & "'"
sql = sql & "where Category = '" & (Trim(Name)) & "'"
adoAssignID.Update sql
Me.cboCategory.Enabled = False
Me.txtFields(0).Enabled = False
End Sub
Thanks in advance for your help.
Andrea