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.
    im wrting a program using visual basic 6.0 and using ms access as data base.
    when it ry to execute the program. and try to save record in database using adodc the system prompt me :
    "Operation Cancelled" runtime error 2147217842(8004 0e4e)
    i dont understand it and im sure that my coding is correct because it actually works smoothly for about 6 to 10 exucution or more and just encounter this problem for the first time
    what shall i do.
    please help me huhuhu :(
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by DUNXALEARE
    please help me.
    im wrting a program using visual basic 6.0 and using ms access as data base.
    when it ry to execute the program. and try to save record in database using adodc the system prompt me :
    "Operation Cancelled" runtime error 2147217842(8004 0e4e)
    i dont understand it and im sure that my coding is correct because it actually works smoothly for about 6 to 10 exucution or more and just encounter this problem for the first time
    what shall i do.
    please help me huhuhu :(
    Post the code. We cannot possibly attempt a solution without seeing it.

    Comment

    • DUNXALEARE
      New Member
      • Mar 2007
      • 21

      #3
      Originally posted by ADezii
      Post the code. We cannot possibly attempt a solution without seeing it.
      Code:
      Private Sub saves_Click()
      
      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
      I dont put the other codes thats were the problem generates during run time
      im using visual basic 6. 0
      ms access 2003
      thanx.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by DUNXALEARE
        Code:
        Private Sub saves_Click()
        
        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
        I must admit that I am having a little trouble following the Logic and Syntax of your code. This is only a suggestion, but before I do anything else, I woould write the code in a more logical, though longer, format:
        Code:
        Select Case act
          Case 2
            Select Case cond
              Case 0
                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
              Case 1
                ans = MsgBox("Are you sure you want to save this record?", vbYesNo, Label)
                  If ans = vbYes Then
                    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
              Case Else
                'act = 2 and cond <> 0 or 1
            End Select
          Case 3
            If 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
            Else
              'act = 3 and cond <> 1
            End If
          Case Else
            'act <> 2 or 3
        End Select
        
        act = Empty
        acts = Empty
        Form_Load
        
        4:

        Comment

        • DUNXALEARE
          New Member
          • Mar 2007
          • 21

          #5
          Originally posted by ADezii
          I must admit that I am having a little trouble following the Logic and Syntax of your code. This is only a suggestion, but before I do anything else, I woould write the code in a more logical, though longer, format:
          Code:
          Select Case act
            Case 2
              Select Case cond
                Case 0
                  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
                Case 1
                  ans = MsgBox("Are you sure you want to save this record?", vbYesNo, Label)
                    If ans = vbYes Then
                      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
                Case Else
                  'act = 2 and cond <> 0 or 1
              End Select
            Case 3
              If 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
              Else
                'act = 3 and cond <> 1
              End If
            Case Else
              'act <> 2 or 3
          End Select
          
          act = Empty
          acts = Empty
          Form_Load
          
          4:

          well I admit reading my code is like walking in a maze :)
          im not just familiar in using select case.
          thanks for editing it folks.
          it stil dont work. i already delete some records(until all of them) in data base to see if there is limitation in saving. I still encountered the the error.

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            Originally posted by DUNXALEARE
            well I admit reading my code is like walking in a maze :)
            im not just familiar in using select case.
            thanks for editing it folks.
            it stil dont work. i already delete some records(until all of them) in data base to see if there is limitation in saving. I still encountered the the error.
            Set a Breakpoint on Select Case act then single - step (F8) through the code. This will pinpoint the exact line that is causing the Error which is another reason why I did not place multiple Statements on a single line.

            Comment

            • DUNXALEARE
              New Member
              • Mar 2007
              • 21

              #7
              Originally posted by ADezii
              Set a Breakpoint on Select Case act then single - step (F8) through the code. This will pinpoint the exact line that is causing the Error which is another reason why I did not place multiple Statements on a single line.


              OK I get it .
              Code:
              Select Case act=2
              .
              .
              .....Select Case cond=1
                              educ.recordset.movefirst
                              family.recordset.movefirst
                              epis.recordset.movefirst
              .
              .
              end select
              end select
              the epis.recordset. movefirst is highlighted when error occured.
              all the fields connected to it dont save the data i entered, unlike the educ.recordset and family recordset.

              Comment

              • marianoso
                New Member
                • Jan 2008
                • 1

                #8
                I reply to this thread althought is old, because it's the first goole result in this error and it's kinda frustrating to figure this problem out.

                This error happens, amongst other reasons, because the SELECT statement that retrieves the data from the database, does not contain the whole primary key of the table. Somewhy, movefirst, movenext and other methods would fail in this situation, raising this crappy error message.

                At least that happened to me, under MySql 5, with MyODBC and VB6 service pack 6.

                Comment

                • ADezii
                  Recognized Expert Expert
                  • Apr 2006
                  • 8834

                  #9
                  Originally posted by DUNXALEARE
                  OK I get it .
                  Code:
                  Select Case act=2
                  .
                  .
                  .....Select Case cond=1
                                  educ.recordset.movefirst
                                  family.recordset.movefirst
                                  epis.recordset.movefirst
                  .
                  .
                  end select
                  end select
                  the epis.recordset. movefirst is highlighted when error occured.
                  all the fields connected to it dont save the data i entered, unlike the educ.recordset and family recordset.
                  I'm printing all the code and taking it to work with me tomorrow. I'll get back to you on this.

                  Comment

                  • srichey
                    New Member
                    • Feb 2008
                    • 1

                    #10
                    In your code it seems to me that the rs.movefirst command is actually used to update the fields in the database with the new data.
                    Sugguestions:
                    Check to see if locktype is read-only
                    I am having a similar problem in DE and it is only when the locktype is read-only. And it only is happening when i have info placed in a combobox and the movefirst command is called.

                    ???

                    Comment

                    • ADezii
                      Recognized Expert Expert
                      • Apr 2006
                      • 8834

                      #11
                      Originally posted by DUNXALEARE
                      OK I get it .
                      Code:
                      Select Case act=2
                      .
                      .
                      .....Select Case cond=1
                                      educ.recordset.movefirst
                                      family.recordset.movefirst
                                      epis.recordset.movefirst
                      .
                      .
                      end select
                      end select
                      the epis.recordset. movefirst is highlighted when error occured.
                      all the fields connected to it dont save the data i entered, unlike the educ.recordset and family recordset.
                      What do epis, educ, and family explicitly refer to? Could there be a chance that the Recordset contains no Records? In that case a MoveFirst would generate an Error.

                      Comment

                      Working...