| | |
error updating access database using vb..
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmd_edit_Click() 'I'd advice you to use SQL statements 'Put here your validations 'the code below inserts a record to the database, obviously... 'Here is the syntax on inserting a record on a table 'INSERT INTO <tablename>(Field1,Field2,Field3...) VALUES (Value1, value2, value3) rs.Open "INSERT INTO tblAccess(Access) VALUES ('" & Text1.Text & "')", c, adOpenDynamic MsgBox " add new successful ", vbInformation, "successful" End Sub Private Sub Form_Load() Dim cs As String c.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\COMION.MDB;Persist Security Info=False") rsnew2.Open "select * from company", c, adOpenDynamic Me.text1.Text = rsnew2(2) Me.text2.Text = rsnew2(3) End Sub
Hope this helps...
Proud to be Philippine made...
•
•
•
•
Hi Shouvik..
Thanks .. I tried your code but i am getting the error msg "error in creating the new record."
•
•
•
•
rsnew3!text1=text1.text
rsnew3!text2=text2.text
just replace "text1" and "text2" with actual field names present in your table and make sure you are not sending any empty or null value if your fields have required constraints.
try it and know me what have you finally got.
regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Have a problem? Don't worry just give me a call and I'll fix it for you.
Simply try to use this sample code .
This is the best option.
This is the best option.
vb Syntax (Toggle Plain Text)
con.begin trans con.execute "update table_name set field_name= text1.text" con.committrrans
Share your Knowledge.
![]() |
Similar Threads
- Hello all... Need help updating mysql with php (PHP)
- can help me in updating data (JSP)
- Updating Combo Box (Visual Basic 4 / 5 / 6)
- Updating an Access database with a secondary form (VB.NET)
- Updating a record in an MS Access database file using DataSets (VB.NET)
- Beginners help to migrate from Access to MS SQL fomr VB (Visual Basic 4 / 5 / 6)
- Error connecting to database (ASP.NET)
- adware.mainsearch - how do you get rid of it? (Viruses, Spyware and other Nasties)
- Another Trojan.Bookmarker.Gen (Viruses, Spyware and other Nasties)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: How to: Update record
- Next Thread: update number of functions being called
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






