CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: SQL

  1. #1
    Guest

    SQL

    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'"




  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: SQL

    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.


  3. #3
    Guest

    Re: SQL

    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!



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured