Using SQLite3, I have a databse with two tables: ATTENDEES & HISTORY. In HISTORY table, I have a Foreign Key that references ATTENDEE_ID from ATTENDEES table. I have two DBGrids on my form, one for each table. When a record is selected from ATTENDEES table, I'm trying to use that record's ATTENDEE_ID to access that person's history on HISTORY table.
My select statement:
Query2.SQL.Text:= 'SELECT * FROM HISTORY WHERE FK_ATTENDEE_ID = ATTENDEES.ATTENDEE_ID';
Query2.ExecSQL;
which produces the error:
no such column: ATTENDEES.ATTENDEE_ID
So I tried:
Query2.SQL.Text:= 'SELECT * FROM HISTORY WHERE FK_ATTENDEE_ID = ' +Query1.FieldByName('ATTENDEE_ID').Value;
Query2.ExecSQL;
which gave me:
Invalid variant type cast
I lit up Google last night trying to find examples for this, to no avail. Can someone set me on the right track?
Much appreciated,
Landslyde