|
-
Sep 3rd, 2010, 12:59 AM
#1
Thread Starter
New Member
[RESOLVED] selecting data from mdb
Hi there,
i have a problen selecting data from an Access Database.
i am using Microsoft DAO 3.6 Object Library
i have the followin tables:
testA (id number, vctext text)
1,"a"
4,"b"
testB(id number, vctext text)
1,"a"
2,"b"
1,"a "
2,"b "
my code is:
Private Sub Form_Load()
Dim sSql As String
Dim gdbloc As Database
DBEngine.SetOption dbImplicitCommitSync, "YES"
Set gdbloc = OpenDatabase("c:\test.mdb", False, False, "")
sSql = "select testa.id as item_no, testb.vctext as DESC_1TB from "
sSql = sSql & "testA left join testB on (testa.vctext = testb.vctext) "
sSql = sSql & " order by testa.id "
Set rs = gdbloc.OpenRecordset(sSql, dbOpenSnapshot)
While Not rs.EOF
MsgBox (rs!item_no & " " & rs!DESC_1TB)
rs.MoveNext
Wend
rs.Close
End Sub
and i get 4 Messageboxes saying:
"1 a"
"1 a "
"4 b"
"4 b "
I expected only 2!
Can someone help?
Best Regards
Lars
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|