Results 1 to 4 of 4
  1. #1
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    priority oder of commands


    Hi

    created a form with a data sheet view and ran it all ok

    then set up a button to call the form via a macro and viewed my datasheet in form view.

    After an hour or so of head scratching and trawling google found the option in the macro to change the view to datasheet.

    Ok job done but it does raise the question of hierachy

    MAcros seem to take precedence over form properties?

    Does VBA take precedence over macros?

    Can't seem to find an answer on the web?

    THanks

    Ian

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,431
    macros and vba are basically the same thing - all a macro is is a user interface to create vba code - in much the same way the query window creates sql. Macro's run code interpretively or 'live' whilst vba code can be compiled so it can't be modified and possibly runs faster.

    A macro can be specified to start when the db is opened by calling it autoexec (rather than specifying a form), something that is not possible using vba.

    both macros and vba are event driven - you cannot have the same event activate both a macro and vba, although one could call the other.

    macros/vba only 'take precedence' over form properties if they are run perhaps on a form open or load event. However in the case of using say docmd.openform, you can override certain form properties such as the view (datasheet/form/continuous form/edit) and set form filters

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    the command to open an object has the view property as part of the open command; and as you have discovered this does take precedence over the view property of the object itself.

    if you double click to open a report/form object from then navigation pane it will rely on the view property of the object: but if you use a command you can alter that view - - if gives the developer better flexibility to see the same object in differing views if need be.....

  4. #4
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Hi

    thanks for the clarification

    Ian

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

Similar Threads

  1. Executing AT Commands thru VBA
    By rd.prasanna in forum Programming
    Replies: 4
    Last Post: 04-13-2015, 01:28 PM
  2. Button with too many commands?
    By santinimatias in forum Programming
    Replies: 6
    Last Post: 02-05-2015, 11:56 PM
  3. Using a Priority and updating other records
    By Perceptus in forum Modules
    Replies: 6
    Last Post: 07-08-2014, 11:18 AM
  4. Replies: 2
    Last Post: 06-26-2014, 07:42 AM
  5. SQL Commands in VBA
    By chris.williams in forum Programming
    Replies: 4
    Last Post: 12-20-2012, 10:33 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