spoowiz
asked on
How to access field with same name from 2 tables
Hi,
I have the following code:
sSel = "SELECT * FROM T1, T2"
rst.Open sSel, cnACL, adOpenKeyset, adLockOptimistic
Both T1 and T2 tables have an objid field.
I can access all the fields from T1 and T2 using rst!field format. However, when I try to access T1!objid, I get an error msg stating that "orndinal cannot be found". I figure it must be because objid exists in both tables and I need a special syntax. How can I access T1!objid?
Thanks
I have the following code:
sSel = "SELECT * FROM T1, T2"
rst.Open sSel, cnACL, adOpenKeyset, adLockOptimistic
Both T1 and T2 tables have an objid field.
I can access all the fields from T1 and T2 using rst!field format. However, when I try to access T1!objid, I get an error msg stating that "orndinal cannot be found". I figure it must be because objid exists in both tables and I need a special syntax. How can I access T1!objid?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There is a typo in spoowiz code:
sSel = "SELECT * FROM T1, T2 WHERE T1.objid = T2.objid" ' Delete trailing 'T1'
sSel = "SELECT * FROM T1, T2 WHERE T1.objid = T2.objid" ' Delete trailing 'T1'
ASKER
sSel = "SELECT * FROM T1, T2" _
& " WHERE T1.objid = T2.objidT1"
rst.Open sSel, cnACL, adOpenKeyset, adLockOptimistic