User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 373,936 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,724 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 380 | Replies: 3
Reply
Join Date: Jun 2007
Location: india /bangalore
Posts: 18
Reputation: ITech is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
ITech's Avatar
ITech ITech is offline Offline
Newbie Poster

Help error! at times

  #1  
Mar 22nd, 2008
i have typed this code within my form..


  1. Private Sub Command1_Click()
  2. SQL = "select * from cusinfo"
  3. Call connrecordset(CustomerInfo, SQL)
  4. With CustomerInfo
  5. CustomerInfo.MoveLast
  6.  
  7.  
  8.  
  9. !Name = txtName.Text
  10. !Address = txtAddress.Text
  11.  
  12.  
  13. !DOB = DTDOB.Value
  14. !Age = DateDiff("yyyy", DTDOB.Value, Now()) + Int(Format(Now(), "mmdd") < Format(DTDOB.Value, "mmdd"))
  15. !Sex = cmbSex.Text
  16. !PassportNo = txtPassport.Text
  17. !Country = txtCountry.Text
  18. !City = txtCity.Text
  19. !TelephoneNo = txtHome.Text
  20. !MobileNo = txtMobile.Text
  21. !Email = txtEmail.Text
  22. .Update
  23.  
  24. End With
  25.  
  26.  
  27.  
  28. End Sub
  29.  
  30. Private Sub Form_Load()
  31. Call dbconnection
  32. End Sub

////and in the general module...the connection has been done
see this..



  1. Public SQL As String
  2.  
  3. Public connParadise As ADODB.Connection
  4. Public CustomerInfo As ADODB.Recordset
  5.  
  6.  
  7.  
  8. Public Sub dbconnection()
  9. 'connection to the database
  10. Set connParadise = New ADODB.Connection
  11. connParadise.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\pukoo.mdb;Persist Security Info=False"
  12. connParadise.CursorLocation = adUseClient
  13. connParadise.Open
  14. 'database connection established
  15. End Sub
  16. Public Sub connrecordset(tbname As ADODB.Recordset, sequel As String)
  17. 'connect to record set
  18. Set tbname = New ADODB.Recordset
  19. With tbname
  20. .CursorType = adOpenDynamic
  21. .LockType = adLockOptimistic
  22. .Source = sequel
  23. .ActiveConnection = connParadise
  24. .Open
  25. End With
  26. 'connection to the record set established
  27. End Sub


the problem is when i add data into the database it throws me this error at times

Run-time error `-2147217887(80040e21)`
multiple-step operation generated errors.check each status value


and sumtimes it adds records to the database
Last edited by WolfPack : Mar 22nd, 2008 at 7:07 am. Reason: Added code tags. Use them when you post code. Also corrected indenting.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 20
Reputation: techtix is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
techtix techtix is offline Offline
Newbie Poster

Re: error! at times

  #2  
Apr 3rd, 2008
Try using .AddNew rather than .Update
Reply With Quote  
Join Date: May 2007
Location: India
Posts: 493
Reputation: choudhuryshouvi is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 45
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro in Training

Re: error! at times

  #3  
Apr 3rd, 2008
Originally Posted by ITech View Post
the problem is when i add data into the database it throws me this error at times
Run-time error `-2147217887(80040e21)`
multiple-step operation generated errors.check each status value



do you know the meaning of this error message ?

you will face this error when you try to store value in a field and size of your data is more than the specific field's size.
for example, you are trying to store time in a age field which is probably a numeric field. now if didn't the change default value it should be 10. now if you are inserting time it can be in a format like HH:MMSSS which becomes a numeric value also. now each data type has a limit to store values. a numeric field can hold values from -32768 to +32767. now if you try to store any value beyond this range you will face the above error. the same thing is applicable on other data types also.

so check the field size and its data type and then store your value.

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  
Join Date: Nov 2006
Posts: 658
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 90
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Master Poster

Re: error! at times

  #4  
Apr 3rd, 2008
Hi,

In 6th line, you need
CustomerInfo.AddNew
(To add new data)

You dont require that, if you are Editting the last record.
And as Shouvik, said, Multi-step error is due to Field data type differences. It is always a good Idea to Set MaxLength property of the Textbox.

Regards
Veena
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 6:30 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC