hey im trying to add some data into an access 2000 file but im not sure of what Im doing and Ive ended up with the error:
Item cannot be found in the collection corresponding to the requested name or ordinal
and it stops (logically) on a field call. heres my code:
Sub addProduct()
Rem adds a product to the product table using data from the gui
Dim Cnct As ADODB.Connection 'Connection to the database
Dim ProdRec As ADODB.Recordset 'Product record structure
Set Cnct = New ADODB.Connection
Set ProdRec = New ADODB.Recordset
With Cnct
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & flPath & mdb
.Open
End With
ProdRec.Fields("EAN 8/13"
= form1.txtEAN
ProdRec.Fields("Title"
= form1.txtTitle
ProdRec.Fields("Price"
= form1.txtPrice
'ProdRec.Fields("Category"
= form1.lstCategory
'ProdRec.Fields("Periodity"
= form1.lstPeriodity
ProdRec.AddNew
Cnct.Close
Set Cnct = Nothing
Set ProdRec = Nothing
End Sub
Can any one give me a few pointers please?
TIA
~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
Item cannot be found in the collection corresponding to the requested name or ordinal
and it stops (logically) on a field call. heres my code:
Sub addProduct()
Rem adds a product to the product table using data from the gui
Dim Cnct As ADODB.Connection 'Connection to the database
Dim ProdRec As ADODB.Recordset 'Product record structure
Set Cnct = New ADODB.Connection
Set ProdRec = New ADODB.Recordset
With Cnct
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & flPath & mdb
.Open
End With
ProdRec.Fields("EAN 8/13"
ProdRec.Fields("Title"
ProdRec.Fields("Price"
'ProdRec.Fields("Category"
'ProdRec.Fields("Periodity"
ProdRec.AddNew
Cnct.Close
Set Cnct = Nothing
Set ProdRec = Nothing
End Sub
Can any one give me a few pointers please?
TIA
~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."