Results 1 to 4 of 4
  1. #1
    docroc is offline Novice
    Windows 11 Office 365
    Join Date
    Feb 2025
    Posts
    2

    Weird symptom when opening a form I created

    Hi -

    I created an app for keeping track of our IT inventory. There are several forms:

    Asset List shows all records in the Assets table. For the form's OnCurrent event, I tell it to open the form AssetDetail, which shows details of the particular asset. Works OK. Here's the code for openingAssetDetail:


    Private Sub Form_Current()
    DoCmd.OpenForm "AssetDetail", acNormal, , "AssetTag = Forms![Asset List]![AssetTag]"
    End Sub



    I have a form Seat List, which shows all seats (people's workstations basically). Using the same kind of logic as Asset List, it opens Seat Detail when the OnCurrent event is triggered.for Seat List. Here's that code:

    Option Compare Database

    Private Sub Form_Current()
    DoCmd.OpenForm "Seat Detail", acNormal, , "SeatID=Forms![Seat List]![SeatID]"

    End Sub


    But, with all forms closed, if I open Seat List, I get a message asking for a value for the asset tag....


    ....and, if I say OK, then the AssetDetail form is open as well as the two seat-related forms.


    If I delete the code in Asset List for opening AssetDetail, then the problem with Seat List goes away.

    My intuition is that this has something to do with the modules, but I don't know what.

    I appreciate any guidance.

    Thanks,
    David

  2. #2
    Minty is offline VIP
    Windows 11 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    I've never seen the current event used to open another form.
    Normally you would use a click or double click event or a command button.

    The current event fires every time you move from one record to another. I can't imagine wanting to open a form every time you moved records.
    The normal way to do that would be to have that data displayed in a sub form linked to the main form data, that is displayed all the time, so you aren't constantly opening and closing the same form.

    Any chance you could upload a stripped own version of your DB with enough ambiguous data to let us see what is happening.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    I agree with the above. One thing that could cause this is that you have one or more "things" (e.g. a calculated control or sql statement) on one of the forms (possibly seat list) that refers to the asset list form. Seems to me that you'd be better off using a main form/subform design.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    docroc is offline Novice
    Windows 11 Office 365
    Join Date
    Feb 2025
    Posts
    2
    Thank you both for your advice. I moved both openform procedures to the ondoubleclick events in their respective forms, and the weirdness vanished.

    Best,
    Dave

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 08-17-2023, 04:11 PM
  2. Replies: 2
    Last Post: 06-06-2018, 07:16 AM
  3. Replies: 4
    Last Post: 08-09-2017, 12:06 PM
  4. Replies: 5
    Last Post: 11-01-2016, 09:54 AM
  5. Weird Error on opening a form
    By RayMilhon in forum Forms
    Replies: 1
    Last Post: 01-10-2012, 05:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums