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

    How to execute a batch like list of commands (if even possible in Access)?

    I used to work in another db system, for many years. One of the great features of that system was a way to run a batch like file (they called it PROC) to string commands together and pass parameters. You could use the built-in line-editor to edit a PROC.

    My main menu system used this feature to take a template, fill in the parameters, create the PROC then execute the PROC, then return back to the menus from the PROC. There were great benefits to this approach:
    1. It was easy to change the template with a line editor to add more to a process to run (let’s call it a JOB-all the steps in a particular PROC).
    2. You could inspect the job before, during and after it ran
    3). The job in its entirety was logged, so you could review every job that ran and by whom, when and where.
    4) If the job aborted for some reason, you could delete the completed lines and start the job again where it left off.
    5) The templates had lots of system variable symbols that the menu program could fill in, so not much had to be hard coded.

    I also used this feature to create utilities as described in this post:
    https://www.accessforums.net/showthr...728#post498728

    I know there are macros, and I haven’t gotten into them much. The general consensus isn’t they aren’t great and most developers say write code not macros. But what I’m talking about here is a way to “call/initiate” any Access object even a macro (can a macro call a macro?), form, report, code, etc. with permanence for all the benefits listed above.

    Is there a way to do something like this in Access?

    >>>
    If you're curious what one of these templates looked like, I'll attach a sample.
    Line lines above "PQ" are what tell the menu program what to do (like ask which printer if it's a report) and from "PQ" down is the part that gets parameters filled (funny characters are system delimiters) and the menu program ends with adding itself to run again to the final version of the JOB to run. The runtime PROC (combination of template and menu program filled in parameters) gets written for execution and a copy is placed in a log file.

    999QREQ.txt

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you can have a form that shows all records, then filter the results based on what controls the user enters.
    or
    this can be used to create a query
    or
    you CAN put a bunch of commands in a macro to do things.

    filter results depending on what user fills in :

    Code:
    sub btnFind_click()
    sWhere = "1=1"
    if not isnull(cboState) then   sWhere = sWhere & " and [state]='" & cboState & "'"
    if not IsNull(txtName) then    sWhere = sWhere & " and [Name]='" & txtName & "'"
    if not IsNull(cboGender) then    sWhere = sWhere & " and [Gender]='" & cboGender & "'"
    
     'then filer
    if sWhere = "1=1" then
       me.filterOn = false
    else
       me.filter = sWhere
       me.filterOn = true
    endif
    end sub

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

Similar Threads

  1. Replies: 17
    Last Post: 01-19-2021, 08:07 AM
  2. Replies: 7
    Last Post: 05-27-2016, 01:11 PM
  3. RunSQL vs. QueryDef.Execute vs. CurrentDB.Execute
    By caubetiep1337 in forum Queries
    Replies: 8
    Last Post: 12-16-2015, 05:35 PM
  4. Execute Query on List Box change
    By AllegraAccess in forum Access
    Replies: 1
    Last Post: 03-21-2014, 04:28 PM
  5. Basic commands in Access 2007
    By johnkl49 in forum Access
    Replies: 2
    Last Post: 09-23-2010, 04:07 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