RUN TIME ERROR 2147217842(80040e4e)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DUNXALEARE
    New Member
    • Mar 2007
    • 21

    RUN TIME ERROR 2147217842(80040e4e)

    please help me huhuhu
    im writing a visual basic program and use ms access as data base.
    i use adodc to add,save,edit,s earch 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(8004 0e4e).
    and i cannot longer save any data wahhhh.
    how can i finish my project huhuhu
    please somebody help me :(
  • yoda
    Contributor
    • Dec 2006
    • 291

    #2
    Originally posted by DUNXALEARE
    please help me huhuhu
    im writing a visual basic program and use ms access as data base.
    i use adodc to add,save,edit,s earch 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(8004 0e4e).
    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

    Comment

    • DUNXALEARE
      New Member
      • Mar 2007
      • 21

      #3
      Originally posted by yoda
      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

      Comment

      • yoda
        Contributor
        • Dec 2006
        • 291

        #4
        Originally posted by DUNXALEARE
        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

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by yoda
          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?

          Comment

          • DUNXALEARE
            New Member
            • Mar 2007
            • 21

            #6
            Originally posted by Killer42
            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)

            Code:
            Private Sub saves_Click()
            If act = 3 And cond = 0 Then GoTo 3
            If act = 3 And cond = 1 Then
                MsgBox "The record's identification code has been modified. System failed to update.", vbCritical, label
                epis.Recordset.CancelUpdate: epis.Recordset.MoveFirst: educ.Recordset.MoveFirst: family.Recordset.MoveFirst
            End If
            If act = 2 And cond = 1 Then
                    ans = MsgBox("Are you sure you want to save this record?", vbYesNo, label)
                    If ans = vbYes Then
            3:      educ.Recordset.MoveFirst: family.Recordset.MoveFirst: epis.Recordset.MoveFirst
                    MsgBox "You succesfully save the data", vbOKOnly, label: txt_no(0).Visible = True
                    Else: GoTo 4
                    End If
            ElseIf act = 2 And cond = 0 Then
                ansr = MsgBox("The employee you enter already exist. Would you like the record to display?", vbYesNo, label)
                    If ansr = vbYes Then
                    act = 0: ans = txt_no(0).Text: epis.Recordset.CancelUpdate: educ.Recordset.CancelUpdate: family.Recordset.CancelUpdate: flag = False: saves.Enabled = flag: initialization: search
                    Else
                    epis.Recordset.CancelUpdate: educ.Recordset.CancelUpdate: family.Recordset.CancelUpdate
                    Exit Sub
                    End If
            End If
            act = Empty: acts = Empty: Form_Load
            4:
            End Sub
            actually they work for about 10 to 20 times until i encountered that kind of error
            Last edited by Killer42; Mar 26 '07, 02:34 AM. Reason: Please use [CODE]...[/CODE] tags around your code.

            Comment

            • DUNXALEARE
              New Member
              • Mar 2007
              • 21

              #7
              the continuation of my code

              Code:
              Private Sub check()
              stng = ans
              Set rspos = New ADODB.Recordset
              rspos.Open "EPIpersonal", conn1, adOpenStatic, adLockOptimistic, CmdTable
              Set rs = New ADODB.Recordset
              
              SQL = "select employee_id_no from EPIpersonal "
                  rs.Open SQL, conn1, adOpenStatic, _
                  adLockOptimistic, adcmdtxt
                  Do While rs.EOF = False
                  If rs!employee_id_no = stng Then cond = 0: Exit Sub
                  rs.MoveNext
                  Loop
              rspos.close
              rs.close
              frmEPIS.Height = 8400
              cond = 1
              End Sub
              
              Private Sub initialization()
              pics.Picture = LoadPicture(photo.Text)
              If act = 1 Or act = 2 Or act = 3 Or act = 4 Then
                  If act = 2 Then
                  f(1).Enabled = flag: saves.Enabled = flag
                  photo.Text = Empty: pics.Picture = LoadPicture(Empty) ': pickup.Value = vbUnchecked: pickup.Enabled = flag
                  f(1).Enabled = flag: pi(1).Enabled = flag: txt_mix(32).Visible = False: txt_mix(33).Visible = False
                  pi(0).Enabled = flag: pi(2).Enabled = flag: txt_no(0).Visible = False
                  End If
                  f(0).Enabled = True
              Else
                  f(1).Enabled = False: saves.Enabled = False: txt_mix(32).Visible = True: txt_mix(33).Visible = True
                  pi(0).Enabled = False: pi(2).Enabled = False: txt_no(0).Visible = True
                  f(1).Enabled = False: saves.Enabled = False
              End If
              frmEPIS.Height = 8400
              End Sub
              
              Private Sub record()
              If epis.Recordset.RecordCount <> 0 Then
                  If acts = 2 Then epis.Recordset.CancelUpdate: family.Recordset.CancelUpdate: educ.Recordset.CancelUpdate
                  If act <> Empty Then rec = True
                  txt_mix(32).Visible = True: txt_mix(33).Visible = True: txt_no(0).Visible = True
                  If act = 2 Then
                      rec = True: epis.Recordset.AddNew: educ.Recordset.AddNew: family.Recordset.AddNew
                      Text1.Text = cont(1).Caption: Text3.Text = cont(1).Caption: pics.Picture = LoadPicture("") ': photo.Text = Empty
                      txt_mix(32).Visible = False: txt_mix(33).Visible = False: txt_no(0).Visible = False
                  End If
                  pics.Picture = LoadPicture(photo.Text)
              End If
              
              If epis.Recordset.RecordCount = 0 Then
                  If act = 2 Then
                      rec = True: epis.Recordset.AddNew: educ.Recordset.AddNew: family.Recordset.AddNew
                      txt_mix(32).Visible = False: txt_mix(33).Visible = False: txt_no(0).Visible = False
                  End If
                  If act = 1 Or act = 3 Or act = 4 Then MsgBox "There is no data available in database.": rec = False
              End If
              acts = act
              initialization
              End Sub
              
              
              
              Private Sub search()
               If act = 2 And cond = 1 Then
                  ans = txt_no(0).Text
                  check
                  Exit Sub
              End If
              '///
              If act = 1 Or act = 3 Or act = 4 Then
                  If ans = Empty Then
                      ans = InputBox("Enter Employee ID No.", label, vbOKCancel)
                          If ans = Empty Then MsgBox "No Entry. Try again.", vbApplicationModal, label: Exit Sub
                          check
                  End If
                  check
              End If
              '///
              If rec = False Then Exit Sub
              epis.Recordset.MoveFirst: educ.Recordset.MoveFirst: family.Recordset.MoveFirst
              Do Until epis.Recordset.EOF = True
              If txt_no(0).Text = ans Then GoTo 1
              epis.Recordset.MoveNext
              Loop
              1:
              '///
                  If photo.Text = Empty Then pics.Picture = LoadPicture(photo.Text)
                  If photo.Text <> "" Then
                  pics.Picture = LoadPicture(photo.Text)
              StopTrying:
                  retries = 0
                  On Error GoTo 9
              8:
                  End If
              
              Do Until educ.Recordset.EOF = True
                  If Text2.Text = ans Then GoTo 2
              educ.Recordset.MoveNext
              Loop
              2:
              Do Until family.Recordset.EOF = True
              If Text4.Text = ans Then
                  If act = 4 Then
                      ans = MsgBox("Are you sure you want to delete this record.", vbYesNo, label)
                      If ans = vbYes Then
                          epis.Recordset.delete adAffectCurrent: educ.Recordset.delete adAffectCurrent: family.Recordset.delete adAffectCurrent
                          MsgBox "You succesfully delete the data", vbOKOnly, label:  epis.Recordset.MoveFirst
                          act = Empty: acts = Empty: Form_Load: Exit Sub
                      End If
                  Exit Sub
                  End If
                  pi(0).Enabled = flag: pi(1).Enabled = flag: pi(2).Enabled = flag
                  f(1).Enabled = flag: saves.Enabled = flag
                  txt_mix(32).Visible = True: txt_mix(33).Visible = True: txt_no(0).Visible = True
                  Exit Sub
              End If
              family.Recordset.MoveNext
              Loop
              '///
              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)
              MsgBox "No Record Found related to that position code.", vbOKOnly, label: Exit Sub
              Exit Sub
              9:   diskerror: GoTo 8
              End Sub
              (oh forgive for writing such long code: im just a beginner and know only the simple syntax)

              Comment

              • DUNXALEARE
                New Member
                • Mar 2007
                • 21

                #8
                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 :(

                Comment

                • DUNXALEARE
                  New Member
                  • Mar 2007
                  • 21

                  #9
                  SORRY FOLKS! I forgot to read the guidelines for proper posting of reply in a forum. ;(

                  Comment

                  • Killer42
                    Recognized Expert Expert
                    • Oct 2006
                    • 8429

                    #10
                    Originally posted by DUNXALEARE
                    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?

                    Comment

                    • DUNXALEARE
                      New Member
                      • Mar 2007
                      • 21

                      #11
                      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) ;(

                      Comment

                      • Killer42
                        Recognized Expert Expert
                        • Oct 2006
                        • 8429

                        #12
                        Originally posted by DUNXALEARE
                        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?

                        Comment

                        • DUNXALEARE
                          New Member
                          • Mar 2007
                          • 21

                          #13
                          Originally posted by Killer42
                          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.

                          Comment

                          Working...