User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 375,199 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,071 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 261 | Replies: 2
Reply
Join Date: May 2008
Posts: 1
Reputation: dominiopt is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dominiopt dominiopt is offline Offline
Newbie Poster

VB6 ACCESS table union issue

  #1  
May 12th, 2008
Hi list,

After creating a rs with UNION ALL two tables it's possible know record by
record the original table source (using any extra SQL feature or something
else)

SQL = "SELECT * FROM tabA UNION ALL SELECT * FROM tabB ORDER BY field"
Set rs = db.OpenRecordset(SQL)

Thanks
Fernando
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2007
Location: Philippines
Posts: 160
Reputation: jireh is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 16
jireh's Avatar
jireh jireh is offline Offline
Junior Poster

Re: VB6 ACCESS table union issue

  #2  
May 12th, 2008
I don't know what you really mean but if you mean that to look in a PER record I think you do the loop statement.
ie.
SQL = "SELECT * FROM tabA UNION ALL SELECT * FROM tabB ORDER BY field"
Set rs = db.OpenRecordset(SQL)

IF NOT rs.EOF THEN
    DO WHILE NOT rs.EOF
            Text1.Text=rs!Fieldname1
            Text2.Text=rs!Fieldname2
     LOOP
END IF
Last edited by jireh : May 12th, 2008 at 8:13 pm.
Reply With Quote  
Join Date: Nov 2006
Posts: 664
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 92
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Master Poster

Re: VB6 ACCESS table union issue

  #3  
May 13th, 2008
Hi,

Try this :

SQL = "SELECT 'MyTableA' As TabName, A.* FROM tabA A UNION ALL SELECT 'MyTableB' As TabName, B.* FROM tabB B ORDER BY field"
Set rs = db.OpenRecordset(SQL)

RS("TabName") Gives you the Table Name

Regards
Veena
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Thread Tools Display Modes

Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 2:33 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC