Re: Help with SQL Syntax

From: MGFoster (me_at_privacy.com)
Date: 04/29/04


Date: Thu, 29 Apr 2004 20:49:04 GMT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Not sure what you mean by lookup field. I believe you mean the table
column is formatted to show the ScheduleDay in the table. Is this
correct?

Anyway... I believe this query might suit your purposes:

sSQL = "SELECT SD.* " & _
        "FROM ScheduleDetails As SD INNER JOIN Schedule AS S " & _
        " ON SD.ScheduleID = S.ScheduleID " & _
        "WHERE S.fkRidesID = 1"

You have to join the 2 tables by the ScheduleID (the column that relates
the data in Schedule to data in ScheduleDetails).

-- 
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQJFqQ4echKqOuFEgEQKcLwCgrLX1hkvLEgqQHfsWSMCsu2kCPVMAoOnb
vUkJDCBmNyA12b00sW0NltdA
=frUW
-----END PGP SIGNATURE-----
CJ wrote:
> Hi!
> 
> Regarding this statement:
> 
> sSQL = "SELECT * FROM ScheduleDetails WHERE fkScheduleID = 
> 1"
> 
> fkScheduleID is a lookup field, its SQL is:  SELECT 
> [Schedule].[ScheduleID], [Schedule].[fkRidesID], 
> [Schedule].[ScheduleDay] FROM Schedule; 
> 
> What is the proper syntax that will only get the records 
> from ScheduleDetails WHERE the [Schedule].[fkRidesID] 
> value of fkScheduleID is equal to 1
> 
> Thank you in advance for you help!!!