RE: Queries returning with missing info (plus asks query question
- From: Jerry Whittle <JerryWhittle@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 15 Jul 2009 08:15:01 -0700
Let’s start with the simple query first. Try the below and see what happens.
PARAMETERS [Enter Shop] Text;
SELECT [T Master].[Site/Dept],
[T Master].Initiation,
[T Master].Seniority,
[T Master].[First],
[T Master].[Last],
[T Master].Dues,
[T Master].Title,
[T Master].Signedcard,
[T Master].paying,
[T Master].Steward,
[T Master].[Shop Contact],
[T Master].Address,
[T Master].City,
[T Master].State,
[T Master].ZIP,
[T Master].[Phone #],
[T Master].[Alternate #],
[T Master].[Cell #],
[T Master].[E-mail],
[T Master].[Umass Form],
[T Master].[Employee #],
[T Master].[NOTES]
FROM [T Master]
WHERE [T Master].Plant)=[Enter Shop]
AND [T Master].Termed < #1/1/1800#;
At first I thought that the First, Last, and NOTES field names could be a
reserved word problem. Note is a reserved work, but not NOTES. First and Last
are aggregate functions, but not reserved words. Just in case, I put square
brackets around them []. For more about reserved words see:
http://support.microsoft.com/kb/286335/
I’m assuming that [?shop] is a parameter. If so, it’s not declared in the
SQL statement. Plus I’m worried about the question mark being a problem. See
what is at the front of the SQL statement. If the Plant field is a number
instead of text, change it.
Last is the "1/1/1800". If Termed is a proper Date/Time field, it should be
#1/1/1800#. If Termed is a text field, you won’t get the results that you
wanted as "2/1/1799" is greater than "1/1/1800" in a text field.
If the SQL gives you problems still, remove the entire Where clause and the
Parameter clause at the top. Next hard code in a Plant in a Where clause.
Last put back in the Termed in the Where clause. Start from simple and build
back up until you find the problem.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
"spark" wrote:
orignal:.
SELECT [T Master].[Site/Dept], [T Master].Initiation, [T Master].Seniority,
[T Master].First, [T Master].Last, [T Master].Dues, [T Master].Title, [T
Master].Signedcard, [T Master].paying, [T Master].Steward, [T Master].[Shop
Contact], [T Master].Address, [T Master].City, [T Master].State, [T
Master].ZIP, [T Master].[Phone #], [T Master].[Alternate #], [T Master].[Cell
#], [T Master].[E-mail], [T Master].[Umass Form], [T shop_list].[Shop Name],
[T Master].[Employee #], [T Master].NOTES
FROM [T Master] LEFT JOIN [T shop_list] ON [T Master].Plant = [T
shop_list].Code
WHERE ((([T Master].Plant)=[?shop]) AND (([T Master].Termed)<"1/1/1800"));
changed to:
SELECT [T Master].[Site/Dept], [T Master].Initiation, [T Master].Seniority,
[T Master].First, [T Master].Last, [T Master].Dues, [T Master].Title, [T
Master].Signedcard, [T Master].paying, [T Master].Steward, [T Master].[Shop
Contact], [T Master].Address, [T Master].City, [T Master].State, [T
Master].ZIP, [T Master].[Phone #], [T Master].[Alternate #], [T Master].[Cell
#], [T Master].[E-mail], [T Master].[Umass Form], [T Master].[Employee #], [T
Master].NOTES
FROM [T Master]
WHERE ((([T Master].Plant)=[?shop]) AND (([T Master].Termed)<"1/1/1800"));
"Jerry Whittle" wrote:
Show us the SQL for the query that you just changed and the way it was before
you removed reference to the second table. That might tell us something.
Open the query in design view. Next go to View, SQL View and copy and past
it here.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
- Follow-Ups:
- References:
- Queries returning with missing info (plus asks query question twic
- From: spark
- RE: Queries returning with missing info (plus asks query question twic
- From: Jerry Whittle
- RE: Queries returning with missing info (plus asks query question
- From: spark
- RE: Queries returning with missing info (plus asks query question
- From: Jerry Whittle
- RE: Queries returning with missing info (plus asks query question
- From: spark
- Queries returning with missing info (plus asks query question twic
- Prev by Date: RE: Add proceeding zeros to zip less than 5 characters
- Next by Date: RE: Transposing data
- Previous by thread: Re: Queries returning with missing info (plus asks query question
- Next by thread: RE: Queries returning with missing info (plus asks query question
- Index(es):
Relevant Pages
|