Wrox Programmer Forums
|
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 16th, 2006, 09:13 AM
Authorized User
 
Join Date: May 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query help

I have a query that worked fine. I needed to add 1 more table in and when i did it went haywire. When i select one record it is setting all the records with Create CSV to true and picking them all up.

Here it is
Code:
SELECT [Clients].[Title], [Clients].[Full Name], [Clients].[Address], [Clients].[Post Code], [Proposals].[Agreement Date (Supplier Paid Date)], [Proposals].[Doc Fee], [Proposals].[Commission (£)], [Proposals].[VAT on Commission], [Proposals].[Fixed /Variable], [Proposals].[OTP Fee], [Proposals].[Asset Description], [Proposals].[Registration Number], [Proposals].[Chassis Number], [Proposals].[Serial Number], [Proposals].[Year Of Manufacture], [Proposals].[New / Used], [Proposals].[Cash Price], [Proposals].[VAT], [Proposals].[Deposit], [Proposals].[Drawdown], [Proposals].[Term], [Proposals].[Instalment Interval], [Proposals].[Instalment Value], [Proposals].[Final Installment - Balloon], [Proposals].[Final Payment], [Proposals].[Date to First Payment], [Proposals].[Date of Balloon], [Clients].[Sort Code], [Clients].[Acc number], [Clients].[Acc Name], [Proposals].[Create CSV]
FROM Clients, Proposals
WHERE ((([Proposals].[Create CSV])=True));
Anyone have any ideas on how to just get the one record. When i was using it with just the one table getting 1 record was no problem

Allan

 
Old June 16th, 2006, 02:33 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You never indicate that you just want to show the Client entry taht corresponds to the Proposal entry. I assume that somewhere in the Proposals table there is a field that identifies the Client making the proposal (call it ClientID for now), and that it matches up with some field in the Clients table (call it ID for now).

Your query should look like:

SELECT ...
FROM Proposals LEFT JOIN Clients ON Proposals.ClientID = Clients.ID
WHERE [Proposals].[Create CSV] = True;






Similar Threads
Thread Thread Starter Forum Replies Last Post
Output Query to txt file from SQL Query everest SQL Server 2005 4 November 22nd, 2007 01:49 AM
how to make a query from an existing query raport SQL Language 3 November 13th, 2006 08:59 PM
I solved insert query.now see this Update Query. [email protected] VB.NET 2002/2003 Basics 2 September 21st, 2006 12:48 AM
Syntax error in query. Incomplete query clause. dispickle ADO.NET 3 April 16th, 2004 01:04 PM
Error on Make-Table Query In Union Query rylemer Access 1 August 20th, 2003 07:42 PM





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