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 391,969 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 4,097 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:

error! at times

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  
All times are GMT -4. The time now is 9:21 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC