-
Hi Everyone!
Could someone help me out with learning this?
I am using DAO. I'm using this code to open a database and select a table to work with:
Set db = OpenDatabase ("C:\db2")
' open up the dynaset
Set rs = db.OpenRecordset("TableName1", dbOpenDynaset)
This works great. :) Now I want to open two tables just like when using recordsource with datacontrol:
strSQL = "Select * from _ TableName1,TableName2 _
where TableName1.Id_num = Table2.Id_num"
Set db = OpenDatabase ("C:\db2")
' open up the dynaset
Set rs = db.OpenRecordset strSQL, dbOpenDynaset)
This doesn't work great :(
Any Code or Help is really appreciated!
Thanks Again,
Joey O
-
Change your select statement to this:
Select * from TableName1 Inner Join TableName2 On _
TableName1.Id_num = Table2.Id_num
Also, you have to be sure that those 2 tables related, I mean that they have common Id_num values.
[Edited by Serge on 04-13-2000 at 11:18 AM]
-
That was fast! Thanks Surge, I'm so glad you could help me. Someday I hope I can help you too!
Joey O