943,597 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Feb 27th, 2008
0

Re: error updating access database using vb..

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vikas1111 is offline Offline
5 posts
since Feb 2008
Feb 27th, 2008
0

Re: error updating access database using vb..

Now i see.. You should learn first the basic Database Programming in VB 6..
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
werks is offline Offline
57 posts
since Jan 2008
Feb 27th, 2008
0

Re: error updating access database using vb..

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...
Reputation Points: 12
Solved Threads: 19
Junior Poster
cometburn is offline Offline
122 posts
since Feb 2008
Feb 28th, 2008
0

Re: error updating access database using vb..

Click to Expand / Collapse  Quote originally posted by vikas1111 ...
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 :-
Quote ...
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
Reputation Points: 30
Solved Threads: 49
Posting Pro
choudhuryshouvi is offline Offline
553 posts
since May 2007
Feb 28th, 2008
0

Re: error updating access database using vb..

Simply try to use this sample code .
This is the best option.

vb Syntax (Toggle Plain Text)
  1. con.begin trans
  2. con.execute "update table_name set field_name= text1.text"
  3. con.committrrans
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: How to: Update record
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: update number of functions being called





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC