Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    New England (Connecticut)
    Posts
    200
    Thanks
    1
    Thanked 0 Times in 0 Posts

    MDE -vs- MDB (office 97 on NT4.0)

    THis is really strange to me. I have a database which I made an MDE from. The MDB version works perfectly. The MDE version gives me an error message when it is closed via the close button "x" at the top right of the screen. I know where the error is generated but don't know why. The scenario is as follows: when the user opens the db and opens a form based on a table and closes it via the "x" at the top right of the screen, a requery error messages is generated which is triggered from an "on close" event. I need this requery to take place since there are other processes in the onclose event which follow it. All things being equal the MDB which was used to create this MDE does not generate this message. I have fully compacted (several times) prior to making the MDE. What would cause this to happen and is there a fix?

    Thank You
    Kevin

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDE -vs- MDB (office 97 on NT4.0)

    Do you have an example of the on close event event procedure or even attach a demo of the form.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    New England (Connecticut)
    Posts
    200
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: MDE -vs- MDB (office 97 on NT4.0)

    The following is a snippet of the on close event:

    'Me![Date_Priced] = Now()
    'DoCmd.Requery

    The "Date_Priced" is used to toggle an archieve procedure. If the record is not used for 90 days it rolls into an archieve list so it inserts the date everytime the record is opened.

    Thanks
    Kevin

  4. #4
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDE -vs- MDB (office 97 on NT4.0)

    Not really getting involved in the archive procedure, perhaps your line of would be better located some-where before the form is closed.

    see the attached zip.

    I've added a button on the form which when clicked, creates a message box asking the user if he wants to close the form, if he selects YES, then your code will be run. If NO, the form stays open.

    Hope this helps.

    Check the code behind the button and change the field names to what you need.

    If this is ok, you can then disable the crosshair thru properties.

    Dave

    p.s Put the Me.requery before the DoCmd.close bit.
    Attached Files Attached Files

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

    Re: MDE -vs- MDB (office 97 on NT4.0)

    I'm not sure exactly what your problem is, but for one thing DoCmd.Requery is not the recommended way to requery a form. In fact, the correct syntax is DoCmd.Requery {controlName}, and if no controlname is specified, the current active control is used. If you want to requery the form, use Me.Requery.

    And this form only displays a single record? And when you close the form you update that record to show that it has been looked at? And why is the requery needed?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  6. #6
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDE -vs- MDB (office 97 on NT4.0)

    Sorry Hadn't noticed you are running A97

    Here's the code behind the button;


    Private Sub YourButtonName_Click()
    Dim intButSelected As Integer, intButType As Integer
    Dim strMsgPrompt As String, strMsgTitle As String

    strMsgPrompt = "You have Selected To Close This Form, Do You Want To Continue"
    strMsgTitle = "Close Form"

    intButType = vbYesNo + vbQuestion + vbDefaultButton1
    intButSelected = MsgBox(strMsgPrompt, intButType, strMsgTitle)

    If intButSelected = vbYes Then
    Me.[YourDateFieldName] = Now()
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Me.Requery
    DoCmd.close

    Else
    ' NO button code...
    End If
    End Sub

    Hope this helps

    Dave

Posting Permissions

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