473,385 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

it shows 3265 error number while saving data

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdsave_Click()
  2.  rs.Fields("Emp_id") = cmbempid.Text
  3.  rs.Fields("Absent_date") = lbldate2.Caption//it shows here
  4.  If optabsent.Value = True Then
  5.  rs.Fields("Emp_status") = "absent"
  6.  Else
  7.  rs.Fields("Emp_status") = "latemark"
  8.  End If
  9.  If optapprove.Value = True Then
  10.  rs.Fields("cneck_record") = 1
  11.  Else
  12.  rs.Fields("cneck_record") = 0
  13.  End If
  14. rs.Fields("Leave_type") = txtlname.Text
  15. rs.Update
  16.  cmdfirst.Enabled = True
  17.  cmdlast.Enabled = True
  18.  cmdnext.Enabled = True
  19.  cmdprevious.Enabled = True
  20.  cmdexit.Enabled = True
  21.  cmdadd.Enabled = True
  22.  cmdmodify.Enabled = True
  23.  cmddelete.Enabled = True
  24.  cmdcancel.Enabled = True
  25. End Sub
  26.  
  27. Private Sub Form_Load()
  28. con.Open _
  29. "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=leave;Data Source=ABC"
  30. 'con.Execute "set nocount on"
  31. substring = "select* from muster"
  32. 'rs.CursorLocation = adUseServer
  33. 'rs.Open substring, con, adOpenStatic, adLockPessimistic
  34. With rs
  35.     .CursorType = adOpenStatic
  36.     .CursorLocation = adUseClient
  37.     .LockType = adLockOptimistic
  38.     .ActiveConnection = con
  39.     'Set .ActiveConnection = Nothing
  40. End With
  41. rs.Open substring
  42. 'con.Execute (substring),
  43. 'rs.CursorLocation = adUseServer
  44. substring1 = "select * from Employee"
  45. rs1.Open substring1, con, adOpenDynamic, adLockOptimistic
  46. lbldate2.Caption = Date
  47. substring3 = "select * from leave"
  48. rs2.Open substring3, con, adOpenDynamic, adLockOptimistic
  49. 'cmbempid.AddItem (Form1.txtempno.Text)
  50. Do While Not rs1.EOF
  51.    cmbempid.AddItem rs1(0)
  52.    rs1.MoveNext
  53. Loop
  54. substring4 = " select * from leave_taken"
  55. rs3.Open substring4, con, adOpenDynamic, adLockOptimistic
  56. Dim substring5 As String
  57. Dim int1 As Integer
  58. substring5 = "select distinct emp_id from muster where Leave_type like 'nil'"
  59. If rs.State = adStateOpen Then
  60. rs.Close
  61. End If
  62. rs.Open substring5, con, adOpenDynamic, adLockOptimistic
  63. 'int1 = CInt(Trim(substring5))
  64. If rs.BOF = False Or rs.EOF = False Then
  65. rs.MoveNext
  66. MsgBox "There are 'nil' employee leave type not consider are " & rs.Fields("Emp_id").Value
  67. End If
  68. Call getdata
  69. 'optabsent.Value = False
  70. End Sub
  71. Private Sub optabsent_Click()
  72. optapprove.Enabled = True
  73. optdisapp.Enabled = True
  74. 'optlatemark.Enabled = False
  75. 'If optabsent = True Then
  76.  '  If optapprove = True Then
  77.   '   txtletype.Visible = True
  78.   '   txttotal.Visible = False
  79.    'Else
  80.     ' txtletype.Text = "Nil"
  81.      'txttotal.Visible = True
  82.   'End If
  83. 'Else
  84. '  optapprove.Value = False
  85. '  optdisapp.Value = False
  86.  ' txtletype.Visible = False
  87. 'End If
  88. End Sub
  89.  
  90.  
I check my all feilds in the table all are the correct but it still show the error like this.
Jun 10 '08 #1
1 1387
lotus18
866 512MB
So where is the rs.AddNew on the cmdSave_Click event?

If you are sure with fields I think the reason would be in recordset. Try to create a new public sub procedures (e.g. setCon) and put all your codes in opening your database connection.

Try to open your recordset before adding the new values.

Expand|Select|Wrap|Line Numbers
  1. Call setCon  
  2. rs.Open "Select * From Musters", con, 3, 3
  3. rs.AddNew
  4. <Your codes here....>
  5. rs.Update
  6.  
Don't forget to close the connection as well as the recordet

But I'd suggest you use con.Execute procedure rather than opening the recordset. : )

Rey Sean
Jun 10 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Steve Jorgensen | last post by:
If you've ever employed custom error numbers and messages in you programs, you've probably ended up with code similar to what I've ended up with in the past something like... <code> public...
0
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub)...
4
by: egewitz | last post by:
I keep getting this error and it's driving me crazy: 3265 - Item Not Found In This Collection I'm using MS Access 2003. Through VBA I'm attempting to fill in an excel spreadsheet with a query...
0
by: rajkalacbe | last post by:
I am running a visual basic executable program through Forms4.5 of D2K using Forms menu options.. When I Invoke this form in the server where I have the database installed, I do not have any...
1
by: wassimdaccache | last post by:
Hello Please help me I working on database using access 2003 I'm writing into a save bottom on a form this code to insert some of my value on another table ...no relationship between them ...
2
by: marcohod | last post by:
Hi, I'm using ADO 2.8 in VB6 to use an SQL Server 2000 database. This works: Dim MyRS2 As New ADODB.Recordset MySQL = "Select * from table1" MyRS2.Open MySQL, sqlConnection,...
3
by: DGNinja12 | last post by:
I get this error when i run, i cant figure out what is wrong Can some one please help me? Run-time error '3265': Item cannot be found in the collection corresponding to the requested name or...
0
nurikoAnna
by: nurikoAnna | last post by:
Dim rsFaculty As New ADODB.Recordset Dim rsDepartment As New ADODB.Recordset Dim oCm As New ADODB.Command Private Sub Disconnect() connect.Close End Sub
8
by: charli | last post by:
Error 3265, "Item cannot be found in the collection corresponding to the requested name or ordinal" code programatically opens a query using ADOX and changed the sql Dim cat As New...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.