Results 1 to 5 of 5
  1. #1
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    653

    Passing "parameters" to a form

    In another thread, in a link in post https://www.accessforums.net/showthr...903#post498903

    I found this bit of information:
    "You may want to use both Events. Use Open to get the input parameters, and use Load to set the values of controls based on those supplied parameters."

    I've been looking at lots of sample code, but have yet to see anything that looks like parameters being passed to a form.


    This could be very helpful perhaps in a situation like this (all hypothetical at this point):
    1) Every user enters a normal data entry form with the ability to review the data (read only), but to initiate a change to the data, the "Edit" button has to be pushed.

    2) The menu program that calls the data entry form has validated the user to use the form for this workstation, be attached, day, time, etc. It also knows if this user is allowed to make changes to data in the form (restriction rule).

    3) Can the menu form program pass to the form for data entry (when the former calls the later) the a false condition parameter (among others) for "no editing" or "no new" for this
    user, probably done by disabling the command buttons?

    Example of the command buttons mentioned in another thread:

    Click image for larger version. 

Name:	220805Functionkeys1.jpg 
Views:	21 
Size:	70.5 KB 
ID:	48459

    Can someone share an example of how these "arguments" are passed? As I said, I haven't seen (that I know of) how this is done. And the Access training I took never touched on this kind of thing (among so many others in my posts--again, thanks for all the help and insights over the past few weeks).

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Then of course, there is always Google, always my first point of call.
    https://www.google.com/search?client...to+access+form
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    90% of those button functions are built-in to every form.
    Why are making extra work?

  5. #5
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    I think what you're describing would better match the term user roles\access levels, as restricting access based on user role is a fairly common topic in the Access forums.
    Please feel free to have a look\use my free utility http://forestbyte.com/ms-access-util...access-levels/. In that I use a shared custom system table to store the "access rules" and each form calls a public sub in the open event that loops through that table for the current user level and applies them to the form (enables\disables, locks\unlocks, hides\unhides the various controls on the form and\or sets the allow editing, allow deleting and allow adding for the form itself and any subforms if present).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. "Form.Requery" ignoring new parameters
    By Remster in forum Access
    Replies: 10
    Last Post: 09-10-2018, 11:16 AM
  2. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  3. Replies: 1
    Last Post: 07-10-2015, 06:33 AM
  4. Execute, "Too few parameters", "Expected 2"
    By jhrBanker in forum Forms
    Replies: 3
    Last Post: 10-30-2014, 02:18 PM
  5. Passing criteria "NULL" or "IS NOT NULL" to a query
    By SgtSaunders69 in forum Forms
    Replies: 1
    Last Post: 12-24-2011, 02:22 AM

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