Click to See Complete Forum and Search --> : SQL


August 3rd, 1999, 07:43 AM
I have built a database in access and made a query witch works in access.
This query is suppose to get get all [ID] fiels in a table wich have the date 'Dags' and then get all the [name] fields in another table that have the same ID as those chosen earlier. This is suppose to be the source for a data object.

the code I wrote was this:
Data7.RecordSource = "SELECT [Stundartafla Starfsfóls].Kennitala, '"
"' Staff.NAFN FROM [Stundartafla Starfsfóls] '"
"' INNER JOIN Staff ON '"
"' [Stundartafla Starfsfóls].Kennitala = Staff.KT '"
"' WHERE ((([Stundartafla Starfsfóls].Maetir_dags)= '"
"' Dags ))"

and I get the errormessage: Syntax error (missing operataor) in query expression 'staff.NAFN'"

Lothar Haensler
August 3rd, 1999, 07:51 AM
remove all single quotes from your sql string except for:
"WHERE ((([Stundartafla Starfsfóls].Maetir_dags)= '" & Dags & "'))"
I assume that Dags is a program variable not a field name.

August 3rd, 1999, 08:26 AM
You are right but this was just used as a test variable. The real problem seems to be that my program does not see two tables it seems to just look at the [Stundartafla Starfsfóls] and not see any Staff table.

If I try to expain further I have two tables and one variable a date
Table1 has the fields [ID][DATE] (The day a person will be working)
Table2 has the fields [ID][NAME]
and I want to see just the [NAME][ID] of those hwo will be working a sertain day
An I Want this information put into a Data object.
thanks!
your favorit Gosto!