I need help with sql statement that includes two tables
one table has id and name, lets call it tbluser
second table has id and all other info, lets call it tblinfo

Something like this
Select id from tbluser where name = txtname
Select * from tblinfo where id = id selected from first table

I know how to do this with two select statements, wondering how to do it in one

Recommended Answers

All 3 Replies

The following are my two select statements which work perfectly
How exactly would you do that in one?

adouser.RecordSource = "SELECT * FROM tbluser WHERE name = '" & struser & "'"
    adouser.Refresh
    adoreminder.RecordSource = "SELECT * FROM tbltermin WHERE reminder <= " & Format$(Now, "\#m\/d\/yyyy hh:mm:ss\#") & _
                               "AND userid = " & adouser.Recordset("id") & _
                               "AND remind = " & "true"
    adoreminder.Refresh

ok, I figured it out, here is what I did, thanks for your help
adoreminder.RecordSource = "SELECT * FROM tbltermin INNER JOIN tbluser ON tbltermin.userid = tbluser.id Where tbluser.name = '" & struser & "'" & _
"AND tbltermin.reminder <= " & Format$(Now, "\#m\/d\/yyyy hh:mm:ss\#") & _
"AND remind = " & "true"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.