Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2008

    Unanswered: Acc 2007 - Cmd Button, open form, specific data

    When I create a command button with the wizard to open a form showing "specific data" in Access 2007, the button doesn't work properly.

    The new button will open the form, and turn on the filter, but all the records are showing.

    The embedded macro that is created for this button has a where condition of
    "[Dept ID]=" & [Dept ID].

    The VBA code that's created in 2003 reads "[Dept ID]=" & Me![Dept ID]

    I tried using this as the where condition in the 2007 database and it came up with the missing parameter value.

    I'm stumped.

    I know I can create a limiting query to match the value on the form and have the macro open the form based on that query, but Id like the button to just WORK.

    Help? Suggestions? Commiserations?

  2. #2
    Join Date
    Nov 2007
    Adelaide, South Australia

    Just write it yourself, it's quicker, easier and FAR less confusing.

    All you need to do is:

    1. Create a command button (no wizard).
    2. Name the button (something the dumb wizard won't do) with something like cmdViewRecords
    3. Set it's On Click property to "[Event Procedure]".
    4. Use the Build button for the On Click property.
    5. Finally, enter or code what you want the button to do:

    DoCmd.OpenForm "FormName", , , "[Dept ID]=" & Me![Dept ID]
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!

    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Jan 2011

    Some notes to this.

    The wizard contains a bug. The where clause doesnot get a preliminary "=".

    The correct definition in the Macro window is:
    '="[Dept ID]=" & [Dept ID]'

    All the best,


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts