Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making my first vb6 frontend for Access database and need help

Status
Not open for further replies.

pe

Technical User
Aug 8, 2001
31
US
I have a frmAddJobNo in VB6 on w2000 that has one text box (txtJobNo) and a cmdAdd button. (I have an ADO connection to my access database that uses tblJobNo in the project on another form.) I want to click on the cmdAdd button and add the text in the txtJobNo to the tblJobNo to my database. Can someone help me with the code for the cmdAdd_click event? Thank you very much.
 
I'm not sure I'm clear on what your trying to do.
Do you just want to put the contents of the text box in your Access table?
If so, here's one way:

dim cn as new adodb.connection
dim rs as new adodb.recordset
cn.open "connection string here"
rs.open "select * from tblJobNo",cn,adOpenStatic,adLockOptimistic
rs.AddNew
rs!fieldname = txtJobNo.text
rs.Update
rs.Close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top