Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 27th, 2003, 04:44 AM
Ben Ben is offline
Authorized User
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parameter Query

Hi All,

I have a form with which I want to populate two fields (A & B) based on another fields value (C) afterupdate.
I have created a Query which will return the two values (for A & B) based on the other (C) using a where clause. However I'm getting stuck on how to link the two fields (A & B) values to the query result.
I checked the query which runs OK. However if I try and populate the two fields (A & B) using code the query returns an error saying there's a parameter required (I'm guessing this is the variable in the where clause).

I looked through the help and I'm thinking I have to use ADO to populate the variable - is this the case? If so how would I go about it?

Or is there another way to do this?

Thanks in advance
Ben
 
Old June 27th, 2003, 12:13 PM
Registered User
 
Join Date: Jun 2003
Location: Leuven (Wilsele), , Belgium.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Hi,
You need to create a query in the query collection in code. Don't include the WHERE part in the SQL string. But you've to specify the Queryname.Parameter(s) in code and accord to these the values of the A en B fields.

Cheers,
Phil Sieben.
Quote:
quote:Originally posted by Ben
 Hi All,

I have a form with which I want to populate two fields (A & B) based on another fields value (C) afterupdate.
I have created a Query which will return the two values (for A & B) based on the other (C) using a where clause. However I'm getting stuck on how to link the two fields (A & B) values to the query result.
I checked the query which runs OK. However if I try and populate the two fields (A & B) using code the query returns an error saying there's a parameter required (I'm guessing this is the variable in the where clause).

I looked through the help and I'm thinking I have to use ADO to populate the variable - is this the case? If so how would I go about it?

Or is there another way to do this?

Thanks in advance
Ben




Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameter Query Help Normie Access 5 February 19th, 2008 01:50 PM
passing parameter to query vladimir Access 6 August 30th, 2006 05:39 AM
XSL - Parameter query. Neal XSLT 4 January 24th, 2006 01:27 PM
Parameter Query Teqlump Access 4 November 11th, 2004 07:21 PM
Non query Report Parameter qa BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 July 2nd, 2004 02:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.