Results 1 to 7 of 7
  1. #1
    VicM is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    52

    Editing Switchboard embedded macro

    Hi,
    Using 32-bit Access 2010 on 64-bit Win7 Pro box.

    I want to modify the Switchboard embedded macro that opens a form. I've tried to add an action to the macro that opens forms, but unable to move it to the line I want.

    The section of embedded macro is as follows:

    If [Command] = 3 Then
    OpenForm
    Form Name =[Argument]
    View Form
    Filter Name


    Where Condition
    Data Mode
    Window Mode Normal
    Stop Macro
    End If

    I want to change this to the following:
    If [Command] = 3 Then
    OpenForm
    If [Argument] = "MyForm" then
    Form Name =[Argument]
    View Form
    Filter Name
    Where Condition
    Data Mode
    Window Mode ReadOnly
    Else
    Form Name =[Argument]
    View Form
    Filter Name
    Where Condition
    Data Mode
    Window Mode Normal
    End If
    Stop Macro
    End If

    When I try adding the action: If [Argument] = "MyForm"

    I'm not able to move that action under the OpenForm line.

    Any suggestions?

    Thanks,
    Vic

    P.S. When the code for the Switchboard was handled in VBA, I had no problem modifying the code at will.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    I expect have to include OpenForm method in both parts of inner If.

    If [Command] = 3 Then
    If [Argument] = "MyForm" then
    OpenForm
    Form Name =[Argument]
    View Form
    Filter Name
    Where Condition
    Data Mode
    Window Mode ReadOnly
    Else
    OpenForm
    Form Name =[Argument]
    View Form
    Filter Name
    Where Condition
    Data Mode
    Window Mode Normal
    End If

    End If


    Otherwise, use VBA.
    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.

  3. #3
    VicM is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    52
    The Switchboard macro is an Unnamed, Embedded macro in the Switchboard form. When viewing the macro steps, Microsoft in their infinite wisdom, grayed out the "Convert macro to VBA" action.
    As a result, I had to create a new Group on the Ribbon and add the "Convert macro to VBA" action to it. Once done, that allowed me to convert the macro and I was able to re-code the If statement that I wanted.
    Happily it works the way I want it to.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    So you converted to VBA?

    Should have had "Convert form macros to VBA" available on ribbon when form is in design view.
    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
    VicM is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    52
    June7
    As I said above: When the macro was in design mode, the "Convert macro to VBA" action was grayed out. That's why I had to create a new group on the ribbon and add that action to it. And yes, it then converted and I was able to modify the VBA code to my needs.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Not the macro design mode, the form design view. "Convert macro to VBA" and Convert form macros to VBA" are two different things.
    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.

  7. #7
    VicM is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    52
    June7
    Thanks for setting me straight!

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

Similar Threads

  1. Macro embedded and VBA
    By jajoju in forum Access
    Replies: 5
    Last Post: 11-22-2016, 06:18 PM
  2. Replies: 2
    Last Post: 06-30-2013, 09:59 AM
  3. Embedded Macro not there
    By notacluewhatimdoing in forum Forms
    Replies: 4
    Last Post: 03-23-2013, 08:04 AM
  4. Embedded macro
    By thart21 in forum Forms
    Replies: 1
    Last Post: 06-28-2011, 12:18 PM
  5. Run Embedded Macro
    By smikkelsen in forum Forms
    Replies: 0
    Last Post: 07-07-2010, 09:44 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