hello...
im trying to insert information from a datagrid into a TempTbl but, i keep getting an error involving "Number of query values and destination fields aren't the same"...here is the code im using for that...
--------------------------------------------------
Private Sub cmdSave_Click()
Dim vall As String
Dim iSQL As String
vall = DataGrid1.Columns(DataGrid1.Col).Text
Set objConnTemp = New ADODB.Connection
With objConnTemp
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Data Source=c:\test\test.mdb"
.Open
End With
iSQL = "Insert Into TempTable (Field1, Field2, Field3, Field4, Field5,)" _
& "Values('" & vall & "')"
Set objRecTemp = New ADODB.Recordset
With objRecTemp
Set .ActiveConnection = objConnTemp
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = iSQL
.CursorType = adOpenDynamic
.Open
End With
MsgBox "thank you"
objRecTemp.Close
Set objRecTemp = Nothing
objConnTemp.Close
Set objConnTemp = Nothing
End Sub
------------------------------------------------------
i checked the table and the code and im inserting the correct amount of fields...any ideas where the problem is???do you think it has to do with my ID field in my table that im using as my primary key(autonumber)???thanks for your time...
im trying to insert information from a datagrid into a TempTbl but, i keep getting an error involving "Number of query values and destination fields aren't the same"...here is the code im using for that...
--------------------------------------------------
Private Sub cmdSave_Click()
Dim vall As String
Dim iSQL As String
vall = DataGrid1.Columns(DataGrid1.Col).Text
Set objConnTemp = New ADODB.Connection
With objConnTemp
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Data Source=c:\test\test.mdb"
.Open
End With
iSQL = "Insert Into TempTable (Field1, Field2, Field3, Field4, Field5,)" _
& "Values('" & vall & "')"
Set objRecTemp = New ADODB.Recordset
With objRecTemp
Set .ActiveConnection = objConnTemp
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = iSQL
.CursorType = adOpenDynamic
.Open
End With
MsgBox "thank you"
objRecTemp.Close
Set objRecTemp = Nothing
objConnTemp.Close
Set objConnTemp = Nothing
End Sub
------------------------------------------------------
i checked the table and the code and im inserting the correct amount of fields...any ideas where the problem is???do you think it has to do with my ID field in my table that im using as my primary key(autonumber)???thanks for your time...