• Run Time error 2046

    Author
    Topic
    #462483

    I have a frmCustomerEntry on which customer information is entered. After completing the information, the operator presses the Check In command button on frmCustomerEntry. At this point I am trying to save the customer information so it will be available when frmCheckIn is opened.

    When the check In button is clicked, I am getting a run time error 2046. The command or action โ€˜Save Recordโ€™ isnโ€™t available.

    Private Sub Check_In_Click()
    If Me.Dirty Then
    If IsNull(Me.CompanyOrDepartment) Then
    Me.CompanyOrDepartment.SetFocus
    MsgBox “Company Name is required. Enter ‘None’ if no company name is available”, vbExclamation
    Cancel = True
    Exit Sub
    End If
    RunCommand acCmdSaveRecord
    End If

    DoCmd.OpenForm “frmCheckIn”, , , “RentPaidDate Between ReportBeg and ReportEnd”
    DoCmd.GoToRecord acDataForm, “frmCheckIn”, acNewRec
    Forms!frmCheckIn!CustomerID = Me.CustomerID
    Forms!frmCheckIn![Res#] = Me.ReservationNumber
    Me.ReservationNumber = Null
    Forms!frmCheckIn!ResBegDte = Me.ResBegDate
    Me.ResBegDate = Null
    Forms!frmCheckIn!ResEndDte = Me.ResEndDate
    Me.ResEndDate = Null
    Forms!frmCheckIn![IATA#] = Me.IATANumber
    Me.IATANumber = Null
    Forms!frmCheckIn![ResID#] = Me.ResID
    Me.ResID = Null
    Me.CustomerStatusID = 1

    End Sub

    Any assistance would be greatly appreciated.

    Tom Goodwin

    Viewing 1 reply thread
    Author
    Replies
    • #1177245

      You are trying to Save in a context where Access cannot Save.
      What is there in the context that makes it impossible to Save?

        [*]One option is that the form is based on a non-updateable query – but in that case you would not be able to enter anything at all.
        [*]Does the data comply with all requirements set at a table level? Required fields?
        [*]Is the form bound or unbound?

      Might you be able to post a stripped down copy of the db?

      • #1177266

        If you close frmCustomerEntry without clicking on the Check In button, all of the information is saved correctly. If you reopen frmCustomerEntry and use the locate record functon for the record just saved, the Check In function works as it is surposed to.

        I am traveling but will post a stripped down version as soon as possible.

        Thanks,

        Tom

        You are trying to Save in a context where Access cannot Save.
        What is there in the context that makes it impossible to Save?

          [*]One option is that the form is based on a non-updateable query – but in that case you would not be able to enter anything at all.
          [*]Does the data comply with all requirements set at a table level? Required fields?
          [*]Is the form bound or unbound?

        Might you be able to post a stripped down copy of the db?

      • #1177287

        I am attaching a stripped down database. Thanks for looking at it.

        Tom Goodwin

        You are trying to Save in a context where Access cannot Save.
        What is there in the context that makes it impossible to Save?

          [*]One option is that the form is based on a non-updateable query – but in that case you would not be able to enter anything at all.
          [*]Does the data comply with all requirements set at a table level? Required fields?
          [*]Is the form bound or unbound?

        Might you be able to post a stripped down copy of the db?

        • #1177301

          I am attaching a stripped down database. Thanks for looking at it.

          I have looked at the attachment, but it does not give the error for me!
          I have tried a few things, but can’t see anything to suggest.
          I am confused by the form frmCustomerEntry.
          It has its Data Entry property set to yes, but it shows existing records.
          It has the Allow Edits property set to No, but allows changes.

          • #1177651

            I am confused by the form frmCustomerEntry.
            It has its Data Entry property set to yes, but it shows existing records.
            It has the Allow Edits property set to No, but allows changes.

            The On Open event of the form runs the macro mcrDisplayAll which undoes the Data Entry setting. In Access 2002, I can’t edit the existing records, but after clicking Add New, I can obviously modify the new record.

            • #1178688

              Sorry for the delay in responding. I was traveling and did not have access to a computer.

              When the frmCustomer is first opened, the first record in the table is displayed. We were having a problem with the operator changing information in the displayed record by mistake so we locked the record. We put in the find last function so the operator would check to see if a new customer was already in the database. If the customer record is found, then it can be edited. Once the operator uses Enter New, then a new blank record is displayed and the new customer can be entered.

              The problem with the CheckIn function seems to be intermittent. I have not yet fully determined whether or not it might be operating system related. When the user first reported the problem I was traveling. I first looked at the problem on a laptop computer using Vista (horrible operating system) and experienced the same problem the user was having.

              I tried it on my office system this morning and it worked fine. I am using Windows XP home edition on my office computer. I have E-mailed the user this morning to see if she is still experiencing the problem. I think they are using Windows XP home edition but I am not sure. I will verify later today. There are up to 16 users using the system on a stand alone basis and no one else has reported a problem. Will inquire of all users in the near future to see if they have ever experienced this problem. They generally are good about reporting abnormal conditions.

              Thanks for your assistance.

              Tom

              The On Open event of the form runs the macro mcrDisplayAll which undoes the Data Entry setting. In Access 2002, I can’t edit the existing records, but after clicking Add New, I can obviously modify the new record.

        • #1177652

          I only get an error message if not all required fields have been entered. As in an earlier topic, you need to perform checks before trying to save the record.

    • #1177277

      Private Sub Check_In_Click()
      If Me.Dirty Then
      If IsNull(Me.CompanyOrDepartment) Then
      Me.CompanyOrDepartment.SetFocus
      MsgBox “Company Name is required. Enter ‘None’ if no company name is available”, vbExclamation
      Cancel = True
      Exit Sub
      End If
      RunCommand acCmdSaveRecord
      End If

      Try Docmd.Runcommand acCmdSaveRecord

      • #1177286

        Thanks for the suggestion. I had previously tried this to no avail. Tried again, also to no avail.

        I will post a stripped down database in a few minutes.

        Tom

        quote name=’PeterN’ date=’14-Sep-2009 12:06′ post=’793293′]
        Try Docmd.Runcommand acCmdSaveRecord
        [/quote]

    Viewing 1 reply thread
    Reply To: Run Time error 2046

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: