How to enter data in vb form and storing data in ms access database

Please, anyone me help on this issue. I have designed a vb form where some textbox data is depended on other one or more textbox data. I want to save all these textboxes data in ms access database (table). I put a data object to link with the ms access table. but the vb form is not working as data entry form and data is not storing in ms access table. plz help and suggest me urgent. For Information: I am using ms visual basic 6.0 and ms access 2003.

Advanced Thanks
Best Regards
S.N.Mazumder Amit


  • Look at this:
    Dim cn As ADODB.Connection
    Dim sql_str As String
    Dim ConString As String
    ConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=somepathmydb.mdb;User Id=admin;Password=;"
    Set cn = New ADODB.Connection
    cn.ConnectionString = ConString
    sql_str = "INSERT INTO target [(field1[, field2[, ...]])]
    VALUES (value1[, value2[, ...]) "
    cn.execute sql_str

    Set cn = Nothing

    target - table name in access
    value1[, value2[, ...] - input values in your VB form

  • asarasar Ondo state

    Private Sub cmdSave_Click()
    adoBooks.Recordset.Fields("Title") =
    adoBooks.Recordset.Fields("Year Published") =
    adoBooks.Recordset.Fields("ISBN") =
    adoBooks.Recordset.Fields("PubID") =
    adoBooks.Recordset.Fields("Subject") =
    End Sub

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!