Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MDB works - MDE fails (A2K)

    1) I start my MDB and everything appears to work.
    2) I make an MDE to the same directory as the MDB
    3) I start the MDE using the same MDW
    4) I test a particular process and it fails
    5) I restart the MDB and the process works
    6) I recreate the MDE, start it and the process fails.

    Any suggestions on how to track this one down? There's no code in the MDE so I can't step the code. And of course I have an error processor in place that has replaced the Access error message and number.

    TIA
    Donald

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: MDB works - MDE fails (A2K)

    Fails how? If not already done, modify your error handler to include err.description. If you are not sure exactly where it is failing, but in some message boxes which display pertinent info, to allow you to pinpoint the problem.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDB works - MDE fails (A2K)

    OK, further study has turned up the following:

    ErrNbr = 2046
    ErrDesc = The command or action 'Save' isn't available now.

    Here is the code that fails:

    ========== Start code
    Private Sub cmdSave_Click()

    Dim strBookmark As String

    On Error GoTo cmdSave_Click_Err ' catch duplicate SSAN

    If IsNull(strUserID) Then
    MsgBox "UserID is required", vbCritical + vbOKOnly, "Save Click"
    txtUserID.SetFocus
    GoTo cmdSave_Click_Exit
    End If

    strBookmark = txtUserID
    RunCommand acCmdSave
    blnFormDirty = False

    Me.Painting = False
    SetControls blnDisabled
    Me.Requery
    cboUserID.Requery
    'make the last record edited the active record
    Me.RecordsetClone.FindFirst "[strUserID] = " & Chr(39) & strBookmark & Chr(39)
    Me.Bookmark = Me.RecordsetClone.Bookmark
    Me.Painting = True

    cmdSave_Click_Exit:
    On Error GoTo 0
    Exit Sub

    cmdSave_Click_Err:
    Me.Painting = True
    varErrNumb = Err.Number
    varErrDesc = Err.Description

    If varErrNumb = 3022 Then
    MsgBox "This UserID already exists." & vbCrLf _
    & "Click 'Add' to correct UserID." & vbCrLf _
    & "Click 'Cancel' to start over.", _
    vbOKOnly + vbCritical, "Save Click"
    cmdCancel.Enabled = True
    Else
    LogError "Unexpected error saving", varModuleName, _
    "Save Click", varErrNumb, varErrDesc
    End If

    Resume cmdSave_Click_Exit

    End Sub 'cmdSave_Click

    ========= End code

    The closest I could find in MSDN is article Q244695, but that is talking about OpenForm. I am starting to suspect the line

    RunCommand acCmdSave

    But don't know how to trap when there is no code to step. I guess I could put in a bunch of debug.prints and see where they stop.

    Thanks.
    Donald

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: MDB works - MDE fails (A2K)

    Try using RunCommand acCmdSaveRecord instead.
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDB works - MDE fails (A2K)

    Nope.

    That won't even work in the MDB.

    Thanks,
    Donald

  6. #6
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDB works - MDE fails (A2K) - Solved

    The answer is:

    Replace

    RunCommand acCmdSave

    With

    Me.Dirty = False

    This works in both the MDB and MDE.

    This caused a problem with the Form_BeforeUpdate event I was using. Since I am taking complete control of saving changes, I was using the BeforeUpdate to check for record changes before allowing changes to records. I just deleted that code and got the functionality I wanted, which is, you have to explicitly save or cancel before changing records. I don

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •