By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,806 Members | 1,380 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,806 IT Pros & Developers. It's quick & easy.

RUN TIME ERROR 2147217842(80040e4e)

DUNXALEARE
P: 21
please help me huhuhu
im writing a visual basic program and use ms access as data base.
i use adodc to add,save,edit,search or delete records on access. for me thats the easiest way.
my program runs smoothly for about 10 to 20 execution until i encountered this problem.
when i try to save a new record the computer prompt me "Operation Cancelled" runtime error 2147217842(80040e4e).
and i cannot longer save any data wahhhh.
how can i finish my project huhuhu
please somebody help me :(
Mar 25 '07 #1
Share this Question
Share on Google+
12 Replies


yoda
100+
P: 291
please help me huhuhu
im writing a visual basic program and use ms access as data base.
i use adodc to add,save,edit,search or delete records on access. for me thats the easiest way.
my program runs smoothly for about 10 to 20 execution until i encountered this problem.
when i try to save a new record the computer prompt me "Operation Cancelled" runtime error 2147217842(80040e4e).
and i cannot longer save any data wahhhh.
how can i finish my project huhuhu
please somebody help me :(
this is a very ggod question i don't know i've looked all over the internet found nothing maybe one of the experts might know.

Sorry

Yoda
Mar 25 '07 #2

DUNXALEARE
P: 21
this is a very ggod question i don't know i've looked all over the internet found nothing maybe one of the experts might know.

Sorry

Yoda

do you know any expert, who can answer my queastion?
wahhh my deadline of submission is coming. I think your the only up to now who had read my message
Mar 25 '07 #3

yoda
100+
P: 291
do you know any expert, who can answer my queastion?
wahhh my deadline of submission is coming. I think your the only up to now who had read my message
you could try asking mmccarthy, or killer42 or Dököll. Dököll knows a lot about access and VB so try and pm him i hope i was a help.

Yoda
Mar 25 '07 #4

Expert 5K+
P: 8,434
you could try asking mmccarthy, or killer42 or Dököll. Dököll knows a lot about access and VB so try and pm him i hope i was a help.
I'm afraid database connections are not my strong point. But it would help if you give us as much detail as possible. For example:
  • The version of VB
  • A copy of the relevant code (if any)
  • The precise details of the database which you were working with. Field types, that sort of thing
  • The precise data which was involved at the time of the error.
  • How consistent is the error? Can you reproduce it easily? If so, what conditions are required to reproduce it?
Mar 25 '07 #5

DUNXALEARE
P: 21
I'm afraid database connections are not my strong point. But it would help if you give us as much detail as possible. For example:
  • The version of VB
  • A copy of the relevant code (if any)
  • The precise details of the database which you were working with. Field types, that sort of thing
  • The precise data which was involved at the time of the error.
  • How consistent is the error? Can you reproduce it easily? If so, what conditions are required to reproduce it?


code
the version im using is visual basic 6.0 and ms access as data base.i connect the adodc component to data base in costum properties the adodc
and directly connect the textboxes needed in database through adodc by setting the properties:data source and data field:
this is part of the code i write ( if the following condition is already met)

Expand|Select|Wrap|Line Numbers
  1. Private Sub saves_Click()
  2. If act = 3 And cond = 0 Then GoTo 3
  3. If act = 3 And cond = 1 Then
  4.     MsgBox "The record's identification code has been modified. System failed to update.", vbCritical, label
  5.     epis.Recordset.CancelUpdate: epis.Recordset.MoveFirst: educ.Recordset.MoveFirst: family.Recordset.MoveFirst
  6. End If
  7. If act = 2 And cond = 1 Then
  8.         ans = MsgBox("Are you sure you want to save this record?", vbYesNo, label)
  9.         If ans = vbYes Then
  10. 3:      educ.Recordset.MoveFirst: family.Recordset.MoveFirst: epis.Recordset.MoveFirst
  11.         MsgBox "You succesfully save the data", vbOKOnly, label: txt_no(0).Visible = True
  12.         Else: GoTo 4
  13.         End If
  14. ElseIf act = 2 And cond = 0 Then
  15.     ansr = MsgBox("The employee you enter already exist. Would you like the record to display?", vbYesNo, label)
  16.         If ansr = vbYes Then
  17.         act = 0: ans = txt_no(0).Text: epis.Recordset.CancelUpdate: educ.Recordset.CancelUpdate: family.Recordset.CancelUpdate: flag = False: saves.Enabled = flag: initialization: search
  18.         Else
  19.         epis.Recordset.CancelUpdate: educ.Recordset.CancelUpdate: family.Recordset.CancelUpdate
  20.         Exit Sub
  21.         End If
  22. End If
  23. act = Empty: acts = Empty: Form_Load
  24. 4:
  25. End Sub
actually they work for about 10 to 20 times until i encountered that kind of error
Mar 25 '07 #6

DUNXALEARE
P: 21
the continuation of my code

Expand|Select|Wrap|Line Numbers
  1. Private Sub check()
  2. stng = ans
  3. Set rspos = New ADODB.Recordset
  4. rspos.Open "EPIpersonal", conn1, adOpenStatic, adLockOptimistic, CmdTable
  5. Set rs = New ADODB.Recordset
  6.  
  7. SQL = "select employee_id_no from EPIpersonal "
  8.     rs.Open SQL, conn1, adOpenStatic, _
  9.     adLockOptimistic, adcmdtxt
  10.     Do While rs.EOF = False
  11.     If rs!employee_id_no = stng Then cond = 0: Exit Sub
  12.     rs.MoveNext
  13.     Loop
  14. rspos.close
  15. rs.close
  16. frmEPIS.Height = 8400
  17. cond = 1
  18. End Sub
  19.  
  20. Private Sub initialization()
  21. pics.Picture = LoadPicture(photo.Text)
  22. If act = 1 Or act = 2 Or act = 3 Or act = 4 Then
  23.     If act = 2 Then
  24.     f(1).Enabled = flag: saves.Enabled = flag
  25.     photo.Text = Empty: pics.Picture = LoadPicture(Empty) ': pickup.Value = vbUnchecked: pickup.Enabled = flag
  26.     f(1).Enabled = flag: pi(1).Enabled = flag: txt_mix(32).Visible = False: txt_mix(33).Visible = False
  27.     pi(0).Enabled = flag: pi(2).Enabled = flag: txt_no(0).Visible = False
  28.     End If
  29.     f(0).Enabled = True
  30. Else
  31.     f(1).Enabled = False: saves.Enabled = False: txt_mix(32).Visible = True: txt_mix(33).Visible = True
  32.     pi(0).Enabled = False: pi(2).Enabled = False: txt_no(0).Visible = True
  33.     f(1).Enabled = False: saves.Enabled = False
  34. End If
  35. frmEPIS.Height = 8400
  36. End Sub
  37.  
  38. Private Sub record()
  39. If epis.Recordset.RecordCount <> 0 Then
  40.     If acts = 2 Then epis.Recordset.CancelUpdate: family.Recordset.CancelUpdate: educ.Recordset.CancelUpdate
  41.     If act <> Empty Then rec = True
  42.     txt_mix(32).Visible = True: txt_mix(33).Visible = True: txt_no(0).Visible = True
  43.     If act = 2 Then
  44.         rec = True: epis.Recordset.AddNew: educ.Recordset.AddNew: family.Recordset.AddNew
  45.         Text1.Text = cont(1).Caption: Text3.Text = cont(1).Caption: pics.Picture = LoadPicture("") ': photo.Text = Empty
  46.         txt_mix(32).Visible = False: txt_mix(33).Visible = False: txt_no(0).Visible = False
  47.     End If
  48.     pics.Picture = LoadPicture(photo.Text)
  49. End If
  50.  
  51. If epis.Recordset.RecordCount = 0 Then
  52.     If act = 2 Then
  53.         rec = True: epis.Recordset.AddNew: educ.Recordset.AddNew: family.Recordset.AddNew
  54.         txt_mix(32).Visible = False: txt_mix(33).Visible = False: txt_no(0).Visible = False
  55.     End If
  56.     If act = 1 Or act = 3 Or act = 4 Then MsgBox "There is no data available in database.": rec = False
  57. End If
  58. acts = act
  59. initialization
  60. End Sub
  61.  
  62.  
  63.  
  64. Private Sub search()
  65.  If act = 2 And cond = 1 Then
  66.     ans = txt_no(0).Text
  67.     check
  68.     Exit Sub
  69. End If
  70. '///
  71. If act = 1 Or act = 3 Or act = 4 Then
  72.     If ans = Empty Then
  73.         ans = InputBox("Enter Employee ID No.", label, vbOKCancel)
  74.             If ans = Empty Then MsgBox "No Entry. Try again.", vbApplicationModal, label: Exit Sub
  75.             check
  76.     End If
  77.     check
  78. End If
  79. '///
  80. If rec = False Then Exit Sub
  81. epis.Recordset.MoveFirst: educ.Recordset.MoveFirst: family.Recordset.MoveFirst
  82. Do Until epis.Recordset.EOF = True
  83. If txt_no(0).Text = ans Then GoTo 1
  84. epis.Recordset.MoveNext
  85. Loop
  86. 1:
  87. '///
  88.     If photo.Text = Empty Then pics.Picture = LoadPicture(photo.Text)
  89.     If photo.Text <> "" Then
  90.     pics.Picture = LoadPicture(photo.Text)
  91. StopTrying:
  92.     retries = 0
  93.     On Error GoTo 9
  94. 8:
  95.     End If
  96.  
  97. Do Until educ.Recordset.EOF = True
  98.     If Text2.Text = ans Then GoTo 2
  99. educ.Recordset.MoveNext
  100. Loop
  101. 2:
  102. Do Until family.Recordset.EOF = True
  103. If Text4.Text = ans Then
  104.     If act = 4 Then
  105.         ans = MsgBox("Are you sure you want to delete this record.", vbYesNo, label)
  106.         If ans = vbYes Then
  107.             epis.Recordset.delete adAffectCurrent: educ.Recordset.delete adAffectCurrent: family.Recordset.delete adAffectCurrent
  108.             MsgBox "You succesfully delete the data", vbOKOnly, label:  epis.Recordset.MoveFirst
  109.             act = Empty: acts = Empty: Form_Load: Exit Sub
  110.         End If
  111.     Exit Sub
  112.     End If
  113.     pi(0).Enabled = flag: pi(1).Enabled = flag: pi(2).Enabled = flag
  114.     f(1).Enabled = flag: saves.Enabled = flag
  115.     txt_mix(32).Visible = True: txt_mix(33).Visible = True: txt_no(0).Visible = True
  116.     Exit Sub
  117. End If
  118. family.Recordset.MoveNext
  119. Loop
  120. '///
  121. ans = Empty: pi(0).Enabled = False: pi(1).Enabled = False: pi(2).Enabled = False: f(1).Enabled = False: saves.Enabled = False: pics.Picture = LoadPicture(photo.Text)
  122. MsgBox "No Record Found related to that position code.", vbOKOnly, label: Exit Sub
  123. Exit Sub
  124. 9:   diskerror: GoTo 8
  125. End Sub
(oh forgive for writing such long code: im just a beginner and know only the simple syntax)
Mar 25 '07 #7

DUNXALEARE
P: 21
the part which were highlight when there is runtime error is one of the adodc I used (epis.recordset.movefirst).
i try to eliminate some datafields in the tables were that adodc is connected, because i thought, i used so many field in that particular table, but i failed. wahhhhh :(
Mar 25 '07 #8

DUNXALEARE
P: 21
SORRY FOLKS! I forgot to read the guidelines for proper posting of reply in a forum. ;(
Mar 26 '07 #9

Expert 5K+
P: 8,434
SORRY FOLKS! I forgot to read the guidelines for proper posting of reply in a forum. ;(
Um... what do you think you did wrong?

I edited a couple of your posts to put CODE and /CODE tags around your VB source code, but apart from that (which everyone gets wrong at least the first few times) I didn't see anything to complain about.

Anyway, I have some more questions, which may require some investigation on your part. Look on the bright side, though - this is valuable debugging experience. :)

You say that it works for "10 to 20" times. Is this dependent on the data, or on the number of times executed? If it's the number of executions, is it consistent? In other words, is it (for example) always the 15th record, or does it vary?
Mar 26 '07 #10

DUNXALEARE
P: 21
no. i even try to delete some record(until all of them) in the database to see if there is a limitation in saving data. when i try again to execute the program, i still encountered the same error ( meaning i cant even save the new data even the database is empty) ;(
Mar 26 '07 #11

Expert 5K+
P: 8,434
no. i even try to delete some record(until all of them) in the database to see if there is a limitation in saving data. when i try again to execute the program, i still encountered the same error ( meaning i cant even save the new data even the database is empty) ;(
It sure sounds as though there must be something wrong with "the new data". Can you interrupt execution and check the values of all fields immediately before the error? Or when the error occurs?
Mar 27 '07 #12

DUNXALEARE
P: 21
It sure sounds as though there must be something wrong with "the new data". Can you interrupt execution and check the values of all fields immediately before the error? Or when the error occurs?
i observed that 3 of the textboxes always lost the data it contained (one of them is connected to the primary field of my table in database), when the error occured.
Mar 27 '07 #13

Post your reply

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