Question Locked

add data in an access tabel using vb6.0 and ado

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have an application in VB 6.0 using ADO and Access. In a form exist a datagrid wich helps me to view the data, but now I want to add all the data from this grid in a table, how can i do that, because I tried this code:
'********************************************
Dim siruladd As String

siruladd = "select * from carriers_rates "
rstadd.Open siruladd, Conex
With rstadd
.Filter = "carrier_code='" & frmImport!txtCarrierCode.Text & "' AND concatenate_code_by_carrier='" & frmImport!dgImport.Columns(1).Text & "' AND date='" & frmImport!dtpData.Value & "' "
If .RecordCount = 0 Then
.AddNew
rstadd!carrier_code = frmImport!txtCarrierCode.Text
rstadd!area_name = frmImport!dgImport.Columns(0).Text
rstadd!concatenate_code_by_carrier = frmImport!dgImport.Columns(1).Text
rstadd!Rate = frmImport!dgImport.Columns(2).Text
rstadd!effective_date = frmImport!dgImport.Columns(3).Text
rstadd!Data = frmImport!dtpData.Value
.Update
Else
MsgBox ("")
End If

End With
'********************************************
and the data is added row by row from the datagrid and I wanted to add all the rows in a single step, how can I do that?

Thank you.

1 reply

This discussion is closed to new replies.