473,395 Members | 1,411 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,395 software developers and data experts.

i have a problem with the cmdNavBar error alway appearing Operation is Not allowed wh

I have a problem with the cmdNavBar error alway appearing Operation is Not allowed:
Expand|Select|Wrap|Line Numbers
  1. <FORM>
  2. Private Sub cbodept_Click()
  3.     If cbodept.Text = "Faculty" Then
  4.         txtgross.Text = "10000"
  5.     Else
  6.     If cbodept.Text = "Accounting" Then
  7.         txtgross.Text = "20000"
  8.     Else
  9.     If cbodept.Text = "Registrar" Then
  10.         txtgross.Text = "15000"
  11.     Else
  12.     If cbodept.Text = "Technical Support" Then
  13.         txtgross.Text = "12000"
  14.     Else
  15.     If cbodept.Text = "Marketing" Then
  16.         txtgross.Text = "18000"
  17.     Else
  18.     If cbodept.Text = "Administrative" Then
  19.         txtgross.Text = "25000"
  20.  
  21.     End If
  22.     End If
  23.     End If
  24.     End If
  25.     End If
  26.     End If
  27.  
  28. End Sub
  29.  
  30. Private Sub cmdaction_Click(Index As Integer)
  31.  
  32.     Select Case Index
  33.  
  34.         Case 0 ' Record
  35.  
  36.             rs.Open "Select * from tblpayroll", cn, 3, 3
  37.             rs.AddNew
  38.             rs!PayrollDate = DTPicker1.Value
  39.             rs!EmployeeNo = txtempno.Text
  40.             rs!EmployeeName = txtempname.Text
  41.             rs!Department = cbodept.Text
  42.             rs!GrossPay = txtgross.Text
  43.             rs!Deduction = txtdeduc.Text
  44.             rs!Net = txtnet.Text
  45.             rs.Update
  46.             MsgBox "New Payroll has been Added!"
  47.  
  48.             Set rs = Nothing
  49.  
  50.         Case 1 ' Delete Record
  51.  
  52.             Dim res As VbMsgBoxResult
  53.             On Error GoTo fixdel
  54.             res = MsgBox("Delete" & txtempname & "information?", vbYesNo + vbQuestion, "confirm")
  55.  
  56.             If res = vbYes Then
  57.                 rs.Open "Select * from tblpayroll where EmployeeNo ='" & txtempno.Text & "'", cn, 3, 3
  58.                 rs.Delete
  59.                 rs.Update
  60.                 rs.Close
  61.                 Set rs = Nothing
  62.             End If
  63.  
  64. fixdel:
  65.  
  66.  
  67.             If Err.Number = 6160 Then
  68.                 MsgBox "No data to delete!", vbOKOnly + vbInformation, "Message"
  69.             End If
  70.  
  71.         Case 2 ' Update record
  72.  
  73.  
  74.             rs.Open "Select * from tblpayroll", cn, 3, 3
  75.             rs!PayrollDate = DTPicker1.Value
  76.             rs!EmployeeNo = txtempno.Text
  77.             rs!EmployeeName = txtempname.Text
  78.             rs!Department = cbodept.Text
  79.             rs!GrossPay = txtgross.Text
  80.             rs!Deduction = txtdeduc.Text
  81.             rs!Net = txtnet.Text
  82.             rs.Update
  83.             MsgBox "Current Payroll has been updated!"
  84.  
  85.             Set rs = Nothing
  86.  
  87.         Case 3 'Search record
  88.  
  89.             FindEmployeeNo = InputBox("Enter Employee Number")
  90.             rs.Open "Select * from tblpayroll where EmployeeNo = '" & txtempno.Text & "'", cn, 3, 3
  91.  
  92.             If rs.EOF Then
  93.                 MsgBox "No Such Record!", vbCritical + vbOKOnly, " Error Search"
  94.             End If
  95.  
  96.         Case 4 ' print
  97.             Set rs = Nothing
  98.  
  99.  
  100.             rs.Open "Select * From tblpayroll", cn, 3, 3
  101.  
  102.  
  103.  
  104.             Set DataReport1.DataSource = rs
  105.  
  106.             DataReport1.Show
  107.  
  108.         Case 5 'exit
  109.  
  110.             End
  111.  
  112.     End Select
  113.  
  114. End Sub
  115.  
  116. Private Sub cmdnavbar_Click(Index As Integer)
  117.  
  118.  
  119.  
  120.    rs.Open "Select * from tblpayroll", cn, 3, 3
  121.  
  122.         Select Case Index
  123.  
  124.             Case 0 'movefirst
  125.                 On Error Resume Next
  126.  
  127.  
  128.                 rs.MoveFirst
  129.                 DTPicker1.Value = rs!PayrollDate
  130.                 txtempno.Text = rs!EmployeeNo
  131.                 txtempname.Text = rs!EmployeeName
  132.                 cbodept.Text = rs!Department
  133.                 txtgross.Text = rs!GrossPay
  134.                 txtdeduc.Text = rs!Deduction
  135.                 txtnet.Text = rs!Net
  136.                 If rs.EOF Then
  137.                      MsgBox "First record!"
  138.                 End If
  139.             Case 1 'Move previous
  140.                 On Error Resume Next
  141.  
  142.                 rs.MovePrevious
  143.                 DTPicker1.Value = rs!PayrollDate
  144.                 txtempno.Text = rs!EmployeeNo
  145.                 txtempname.Text = rs!EmployeeName
  146.                 cbodept.Text = rs!Department
  147.                 txtgross.Text = rs!GrossPay
  148.                 txtdeduc.Text = rs!Deduction
  149.                 txtnet.Text = rs!Net
  150.  
  151.                 If rs.EOF Then
  152.                      MsgBox "First record!"
  153.                 End If
  154.  
  155.             Case 2 ' MoveNext
  156.                 On Error Resume Next
  157.  
  158.                 rs.MoveNext
  159.                 DTPicker1.Value = rs!PayrollDate
  160.                 txtempno.Text = rs!EmployeeNo
  161.                 txtempname.Text = rs!EmployeeName
  162.                 cbodept.Text = rs!Department
  163.                 txtgross.Text = rs!GrossPay
  164.                 txtdeduc.Text = rs!Deduction
  165.                 txtnet.Text = rs!Net
  166.  
  167.                 If rs.EOF Then
  168.                      MsgBox "Last record!"
  169.                 End If
  170.             Case 3 'Move last
  171.                 On Error Resume Next
  172.  
  173.                 rs.MoveLast
  174.  
  175.                 DTPicker1.Value = rs!PayrollDate
  176.                 txtempno.Text = rs!EmployeeNo
  177.                 txtempname.Text = rs!EmployeeName
  178.                 cbodept.Text = rs!Department
  179.                 txtgross.Text = rs!GrossPay
  180.                 txtdeduc.Text = rs!Deduction
  181.                 txtnet.Text = rs!Net
  182.  
  183.                 If rs.EOF Then
  184.                      MsgBox "Last record!"
  185.                 End If
  186.         End Select
  187.  
  188.             rs.Close
  189.  
  190. End Sub
  191.  
  192.  
  193. Private Sub Form_Load()
  194. cn.Open "Provider =Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\db1.mdb"
  195.  
  196.  
  197. End Sub
  198.  
  199. Private Sub txtdeduc_Change()
  200. txtnet.Text = Val(txtgross.Text) - Val(txtdeduc.Text)
  201. End Sub
  202.  
  203. Private Sub txtgross_Change()
  204. txtnet.Text = Val(txtgross.Text) - Val(txtdeduc.Text)
  205. End Sub
  206.  
  207. <MODULE>
  208.  
  209. Public cn As New ADODB.Connection
  210. Public rs As New ADODB.Recordset
  211.  
  212. Sub connect()
  213.   Set cn = New ADODB.Connection
  214.   cn.Open "Provider=Microsoft.Jet.OLED.4.0;Data Source=" & App.Path & "\db1.mdb"
  215.   Set rs = New ADODB.Recordset
  216.   rs.ActiveConnection = cn
  217.   rs.CursorLocation = adUseClient
  218.   rs.CursorType = adOpenDynamic
  219.   rs.LockType = adLockBatchOptimistic
  220.  rs.Open "Select * from tblpayroll", cn, 3, 3
  221.   rs.Open
  222.  
  223. End Sub
  224.  
  225.  
tnx in advance. please help me i need to pass this project for my school project..
Mar 9 '18 #1
1 1497
Frinavale
9,735 Expert Mod 8TB
Please repost the error message and tell us what line the problem is happening on so that we can help you.
Mar 12 '18 #2

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

Similar topics

1
by: | last post by:
A friend of mine has a website that is ASP. I know nothing about ASP. He switched hosting and now his "contact us" form does not work. When you hit submit it gives an error "Error 405 Method not...
5
by: Jucius | last post by:
Using Delphi for developing, I get and delete records from an Access Database 2000. Sometimes, It happened 3 times (but not reproductible), the application did not succeed in connecting the...
5
by: Susan Bricker | last post by:
Greetings! Can you help me? Here's the error: “Run-time error ‘2001’. You canceled the previous operation.” Here's the form description: has 2 controls involved with this error: =...
0
by: | last post by:
Hi, I am using VS2003 .NET. I have a union in my files which is generated by YACC. I am getting the following errors while linking using link.exe(Microsoft (R) Incremental Linker Version...
3
by: Steve Young | last post by:
I am trying to use the webclient class in VB.Net ... in particular I want to upload a file to the web server using: dim responseArray As Byte() = myWebClient.UploadFile(uri,"POST",filename) ...
1
by: Laurent Lequenne | last post by:
Hello There, I just converted a VS 2003 C++ Project into VS 2005. I already made some changes in my headers files, has I had compilations errors with enums declarations. Now everything compiles...
0
by: John | last post by:
Hi, I am getting this error message The remote server returned an error: (405) Method Not Allowed. while trying to execute the following code: Dim myReq As HttpWebRequest =...
3
by: mamta19 | last post by:
Error: opertion is not allowed wirh referencing to closed application
5
by: Sonasang | last post by:
Hi , I am creating a web page with ASP and Javascript.We have shared the foldres containg the code and all our team members are accessing the code. There is no problem for me when i run the...
2
by: Jayesh Patel | last post by:
I am trying to run below query in vb6 but i found runtime error like"Syntax error in Join Operation (Runtime Error)" Please help. Query: SELECT Sum(Ageing_Master.DAYS_0_30) AS SumOfDAYS_0_30 ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.