PC Review


Reply
Thread Tools Rate Thread

Code to set query parameter through command button?

 
 
Aaron
Guest
Posts: n/a
 
      4th Mar 2010
Hi:

I have a command button on a form that triggers a print job of a report that
references a query with a parameter.

I'd like to set that parameter (named [entryid]) off of the id field of the
record that I am viewing on the form.

Thanks in advance,
Aaron
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      4th Mar 2010
On Thu, 4 Mar 2010 12:39:01 -0800, Aaron <(E-Mail Removed)>
wrote:

>Hi:
>
>I have a command button on a form that triggers a print job of a report that
>references a query with a parameter.
>
>I'd like to set that parameter (named [entryid]) off of the id field of the
>record that I am viewing on the form.
>
>Thanks in advance,
>Aaron


Cut out the middleman: change the criterion from [entryid] to

[Forms]![yourformname]![entryid]

using the name of your form and the control on the form containing that ID.

Alternatively, you can use the WhereCondition argument in the OpenForm method
- see the vba help for the Openform Method for details.
--

John W. Vinson [MVP]
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro/code to run "make-table query" from command button on form? PJ Microsoft Access Macros 2 8th Apr 2009 03:49 PM
Clear parameter query form without a command button GD Microsoft Access Forms 4 25th Nov 2008 04:22 PM
Command button resetting a query parameter? BFish via AccessMonster.com Microsoft Access Form Coding 7 8th Mar 2006 05:54 AM
Command button on form needs query, code, something... =?Utf-8?B?TWFyeSBBIFBlcmV6?= Microsoft Access Form Coding 2 22nd Feb 2006 06:25 PM
command button - pass a parameter to open a form based on a query =?Utf-8?B?RGFubnk=?= Microsoft Access Form Coding 8 22nd Apr 2005 10:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:24 AM.