Sql query problem (Query included)

mshelley1

Carbo
Local time
Today, 09:05
Joined
Feb 12, 2006
Messages
45
[RESOLVED] Sql query problem (Query included)

Operating System: Windows XP Pro
Access 2000 (9.0.8948 SP-3)

Problem Category: SQL query


Greetings:
I have a problem that I cannot solve. I have a form named “ALABAMA ARREST REPORT” on that form in a listbox named “List17” the row source is a query named “List17Query” this query is the problem in that I need its search criteria to come from the value of a textbox on the “ALABAMA ARREST REPORT” named “SSN” . Below is the query in question. When I type in a value (Example 1) it works however when I change it to receive the value from the form (Example 2) it does not.

Somebody please help




Example 1

SELECT [Master Name Index].ID, [Master Name Index].Soc, [Master Name Index].[Last Name], [Master Name Index].[First Name], [Master Name Index].MI, [Master Name Index].MOB, [Master Name Index].DOB, [Master Name Index].YOB, [Master Name Index].[Case #], [Master Name Index].Address, [Master Name Index].City, [Master Name Index].State, [Master Name Index].[Zip code], [Master Name Index].[Home phone], [Master Name Index].[Work phone], [Master Name Index].Race, [Master Name Index].Sex, [Master Name Index].Height, [Master Name Index].Weight, [Master Name Index].Hair, [Master Name Index].Eyes, [Master Name Index].Aliases, [Master Name Index].Status
FROM [Master Name Index]
WHERE ((([Master Name Index].Soc) Like "595-90-0000"));




Example 2

SELECT [Master Name Index].ID, [Master Name Index].Soc, [Master Name Index].[Last Name], [Master Name Index].[First Name], [Master Name Index].MI, [Master Name Index].MOB, [Master Name Index].DOB, [Master Name Index].YOB, [Master Name Index].[Case #], [Master Name Index].Address, [Master Name Index].City, [Master Name Index].State, [Master Name Index].[Zip code], [Master Name Index].[Home phone], [Master Name Index].[Work phone], [Master Name Index].Race, [Master Name Index].Sex, [Master Name Index].Height, [Master Name Index].Weight, [Master Name Index].Hair, [Master Name Index].Eyes, [Master Name Index].Aliases, [Master Name Index].Status
FROM [Master Name Index]
WHERE ((([Master Name Index].Soc) Like "*[Forms]![ALABAMA ARREST REPORT]![SSN]"));
.
Resolution:

WHERE ((([Master Name Index].Soc) Like "*" & [Forms]![ALABAMA ARREST REPORT]![SSN]));

Thank you very much "ByteMyzer"

Mshelley1
 
Last edited:
That should be:

WHERE ((([Master Name Index].Soc) Like "*" & [Forms]![ALABAMA ARREST REPORT]![SSN]));
 

Users who are viewing this thread

Back
Top Bottom