error updating access database using vb..

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 5
Reputation: vikas1111 is an unknown quantity at this point 
Solved Threads: 0
vikas1111 vikas1111 is offline Offline
Newbie Poster

Re: error updating access database using vb..

 
0
  #11
Feb 27th, 2008
Hi once again

No i dont have field name text1 in my table in the database
.. error 3265
Item cannot be found in the collection corresponding to the request name or ordinal
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 57
Reputation: werks is an unknown quantity at this point 
Solved Threads: 1
werks's Avatar
werks werks is offline Offline
Junior Poster in Training

Re: error updating access database using vb..

 
0
  #12
Feb 27th, 2008
Now i see.. You should learn first the basic Database Programming in VB 6..
Kenneth
"Better Than Yesterday"
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 122
Reputation: cometburn is an unknown quantity at this point 
Solved Threads: 19
cometburn's Avatar
cometburn cometburn is offline Offline
Junior Poster

Re: error updating access database using vb..

 
0
  #13
Feb 27th, 2008
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub cmd_edit_Click()
  2. 'I'd advice you to use SQL statements
  3. 'Put here your validations
  4. 'the code below inserts a record to the database, obviously...
  5. 'Here is the syntax on inserting a record on a table
  6. 'INSERT INTO <tablename>(Field1,Field2,Field3...) VALUES (Value1, value2, value3)
  7.  
  8. rs.Open "INSERT INTO tblAccess(Access) VALUES ('" & Text1.Text & "')", c, adOpenDynamic
  9. MsgBox " add new successful ", vbInformation, "successful"
  10. End Sub
  11.  
  12.  
  13. Private Sub Form_Load()
  14. Dim cs As String
  15. c.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\COMION.MDB;Persist Security Info=False")
  16. rsnew2.Open "select * from company", c, adOpenDynamic
  17. Me.text1.Text = rsnew2(2)
  18. Me.text2.Text = rsnew2(3)
  19. End Sub

Hope this helps...
Proud to be Philippine made...
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: error updating access database using vb..

 
0
  #14
Feb 28th, 2008
Originally Posted by vikas1111 View Post
Hi Shouvik..
Thanks .. I tried your code but i am getting the error msg "error in creating the new record."
might the error is occurring in these lines :-
rsnew3!text1=text1.text
rsnew3!text2=text2.text
when i was rectifying your code i assumed that you have the fields named "text1" and "text2" in your table. so i wrote the code. but if you are getting the error then try this solution :-
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,119
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 129
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: error updating access database using vb..

 
0
  #15
Feb 28th, 2008
Simply try to use this sample code .
This is the best option.

  1. con.begin trans
  2. con.execute "update table_name set field_name= text1.text"
  3. con.committrrans
Share your Knowledge.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC