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
[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
http://visualbasic-source-code.com/visual-basic-6/
http://visualbasicnetcode.blogspot.com/
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