Using selection from textbox to limit query. (1 Viewer)

Wegets7

Registered User.
Local time
Today, 03:58
Joined
Oct 18, 2004
Messages
40
I am trying to use the title selected in one text box to limit the query that populates another text box.

This is my simplistic attempt at it:

Code:
SELECT COPY.CopyKey, COPY.CopyId, TITLE.Title, TITLE.Edition
FROM COPY INNER JOIN TITLE ON COPY,FK_ISBN=TITLE.PK_ISBN
WHERE(((COIP.CopyKey)Not In 
(SELECT FK_CopyKey Form ISSUES_to_STUDENT WHERE DateIn Is NULL)))
AND TITLE.Title=[forms]![3__ISSUES_to_Student]![TitleList] 
'The last is the simplistic part.

Can anyone point me in the right direction.
Thanks in advance.
Rich
 

llkhoutx

Registered User.
Local time
Today, 05:58
Joined
Feb 26, 2001
Messages
4,018
"SELECT COPY.CopyKey, COPY.CopyId, TITLE.Title, TITLE.Edition
FROM COPY INNER JOIN TITLE ON COPY,FK_ISBN=TITLE.PK_ISBN
WHERE(((COIP.CopyKey)Not In
(SELECT FK_CopyKey Form ISSUES_to_STUDENT WHERE DateIn Is NULL)))
AND TITLE.Title=" & [forms]![3__ISSUES_to_Student]![TitleList]

The textbox is variable and must be referenced, not hardcoded. If the textbox contents is number, enclose it in quqtes, if a date, enclose it with #.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:58
Joined
Feb 19, 2002
Messages
43,720
You also have at least two typos in the SQL.
 

Wegets7

Registered User.
Local time
Today, 03:58
Joined
Oct 18, 2004
Messages
40
Code:
SELECT COPY.CopyKey, COPY.CopyId, TITLE.Title, TITLE.Edition
FROM COPY INNER JOIN TITLE ON COPY,FK_ISBN=TITLE.PK_ISBN
WHERE(((COPY.CopyKey)Not In 
(SELECT FK_CopyKey From ISSUES_to_STUDENT WHERE DateIn Is NULL)))
AND TITLE.Title=[forms]![3__ISSUES_to_Student]![TitleList]
Ok, here is a typo free version.

>The textbox is variable and must be referenced, not hardcoded. If the textbox
>contents is number, enclose it in quqtes, if a date, enclose it with #.

What if it is text such as a book title?
 

Users who are viewing this thread

Top Bottom