Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2022
    Posts
    2

    OpenArg Property of Asset Detail Form in Lending Database

    Hi. I am modifying the Lending database template for distribution, and I am trying to understand how the OpenArg property is being set (assigned) during the macro execution on of the On Load event of Asset Details form. I also want the Asset Details form to open to the record that was double-clicked in the Asset List form (Item field), but without limiting the form to only view the record that was filtered to and allowing the user to use the record navigation buttons to navigate the full set of records.

    Question: How is the OpenArg property being assigned, as I do not see an explicit assignment statement.
    Question: How can I cause the Asset Detail form to open to the record that matches that which was double-clicked, but also leave the form unfiltered?

    As it stands, double-clicking the value in the control opens the form to that record, matching the ID of that which was clicked, but the form opens filtered and only shows that there is one record in the set, even though 86 records exist. If the form filtering option is deselected, then the record navigator does show all 86 records, and the user is able to navigate through the recordset. However, as a distributed database, I do not want the user to have to deselect the filter button each time they open the form to move between records.

    I have tried setting the Filter On Load property in the Data Tab of the Form Properties to 'No', but the form still opens filtered. I have tried examining the On Dbl Click event (Asset List form) macro to see if there is statement that is filtering Asset Details form upon opening; however, I don't see any procedures that causes the form to open filtered.



    Screenshots of the the Asset Details On Load macro and the Asset List On Dbl Click macro are included.Click image for larger version. 

Name:	Asset Details Form On Load.png 
Views:	17 
Size:	42.1 KB 
ID:	48289Click image for larger version. 

Name:	Asset List On Dbl Click.jpg 
Views:	17 
Size:	49.1 KB 
ID:	48290

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    10,885
    a) can't see it either. How do you know that it is being set at all? Perhaps msgbox in the form load macro, i.e.
    if not isnull(openargs) then
    msgbox openargs
    before gotorecord. If no msgbox, then the value is null. IIRC, brackets will cause Access to interpret the contents as a field. Unless you're talking about a field, I'd say it should be as I typed above sans brackets.

    b) can only say, remove gotorecord New part as a start. I don't use macros as they're too limiting and that seems to be the case with most responders here. Perhaps they know the actions and steps to have a macro get the record id from one form and pass it on to another.

    Last but maybe not least, not specifying the valueIfNull parameter means that Nz could return a 0, an empty string, or a Null. Not really a good idea to leave the decision up to Access, especially if you're going to test for a specific value or type.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,063
    Openargs will never be set. MS uses a common set of standard macros in its templates. It accounts for the possibility of Openargs in a particular DB, but no harm if not in current DB.
    I've done what you want with VBA (opening form to a particular record but leaving the entire recordsource available for scrolling), but can't locate my code at the moment. If You're OK with VBA, I can ferret it out and post it here.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    51,209
    So if macro can read [OpenArgs] (BTW, the [] will be added by Access in textbox and macro and query), one would think a macro could set the property. However, I cannot find anything to support that - no examples and no argument in the OpenForm macro command.

    I did a test. An If Then macro action recognizes the [OpenArgs] property.

    Use VBA, at least for any new coding. Maybe take time to convert macros.
    Last edited by June7; 07-11-2022 at 10:10 AM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Join Date
    Jul 2022
    Posts
    2
    Thank you all for the feedback! I really appreciate it. Since I am always learning, I will distribute the DB as-is for now and come up with a VBA solution as an update...gives me something to work on.

    But yeah, I searched high and low (modules, classes...) there is no VBA, from what I saw, in the template DB.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    10,196
    found this link if you want to stay with macros

    https://www.pcreview.co.uk/threads/o...macro.3393321/

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

Similar Threads

  1. Replies: 10
    Last Post: 04-14-2014, 01:42 PM
  2. Location of asset and latest record for asset
    By duramax in forum Queries
    Replies: 11
    Last Post: 05-14-2013, 04:31 PM
  3. Modifying Lending database
    By Nigelsw in forum Access
    Replies: 3
    Last Post: 07-18-2012, 10:22 AM
  4. Personal Property - Asset or Inventory Database?
    By PoliticalOperative in forum Database Design
    Replies: 1
    Last Post: 05-31-2012, 03:03 PM
  5. passing openArg to a listbox on other form
    By focosi in forum Access
    Replies: 7
    Last Post: 08-12-2011, 04:27 PM

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