var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
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 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 I’d like the button to just WORK.
Help? Suggestions? Commiserations?
DO NOT USE WIZARDS TO CODE.
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
. , Microsoft Access Development Specialists CypherBYTE
Microsoft Access . MCP
And all around nice guy! "Heck it's something understood by accountants ... so it can't be 'that' difficult..."
"...teach a man to code and he'll be frustrated for life! "
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,