Howdy, Stranger!

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

Categories

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

MazumderMazumder Member Posts: 2
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

Comments

  • snikulinsnikulin Member Posts: 2
    Look at this:
    [code]
    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
    cn.Open
    sql_str = "INSERT INTO target [(field1[, field2[, ...]])]
    VALUES (value1[, value2[, ...]) "
    cn.execute sql_str

    cn.Close
    Set cn = Nothing

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

  • asarasar Ondo stateMember Posts: 1

    Private Sub cmdSave_Click()
    adoBooks.Recordset.Fields("Title") =
    txtTitle.Text
    adoBooks.Recordset.Fields("Year Published") =
    txtPub.Text
    adoBooks.Recordset.Fields("ISBN") =
    txtISBN.Text
    adoBooks.Recordset.Fields("PubID") =
    txtPubID.Text
    adoBooks.Recordset.Fields("Subject") =
    txtSubject.Text
    adoBooks.Recordset.Update
    End Sub

Sign In or Register to comment.