Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 5th, 2005, 06:19 AM
Registered User
 
Join Date: Jan 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple retrievals

Greetings.

The problem I have is that I need to get two sets of data from tables in an access db, and display them in one object.

When I click this button (you'll have to imaging the button), I need to retrieve:
Code:
[UserName], [Location], [Status], and [LastActivityTime], for each user, where [Online = 'Yes'].
I can get all of the data I need individually, but I need to populate a datagrid with all the required information, and in a single click.

Here's the idea:
The form goes to the top row of the table.
If the user (let's call him Alf) is online, the top row of the datagrid is changed accordingly:

Code:
Username   Location       Status      Last Active
-------------------------------------------------
Alf        Comedy_Room    Member      9:36 PM
If Alf isn't online, it just ignores the entry, and moves to the next one (.MoveNext). Either way, for the next user online, lets' call her 'Nancy', the grid will look like this:


Code:
Username   Location       Status      Last Active
-------------------------------------------------
Alf        Comedy_Room    Member      9:36 PM
Nancy      The_Lockup     Moderator   9:42 PM
How is it possible to retrieve data from one table (UserName WHERE Online = 'Yes') and then from another (Location WHERE UserName = Alf)
(Alf being the name of the user currently in question)?

Thanks for any help or tips.
This isn't urgent, as the trial version of the program doesn't have this function, anyway.

That said, I'd like to get cracking with it, so if you can help me, I'll be your best friend.

Tom

D-Cal,
HRIC, Calisonic.
 
Old May 5th, 2005, 08:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..

dont seeing the structure of your tables dificult the answer, but basically you need to do a join between the table that has the user status and the table where you have the location..
access can do it for you.. .or any other database can construct the query for you...

HTH

Gonzalo
 
Old May 5th, 2005, 01:38 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Code:
SELECT UserName, Location, Status, LastActivityTime
FROM   <put tablename here>
WHERE  Online   = 'Yes'   OR
        UserName = 'Alf'
ORDER BY Online, UserName;
 
Old May 13th, 2005, 10:23 AM
Registered User
 
Join Date: Jan 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot, guys.
I'll try that out when I get back.

If it works, my app will be ready for launch, so it's critical now.

Thanks again.

D-Cal

D-Cal,
HRIC, Calisonic.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Datasets from multiple Data Sources SQL_Hacker Reporting Services 1 June 18th, 2008 02:25 PM
Importing Multiple files in Multiple tables Versi Suomi Access 6 June 1st, 2005 08:47 AM
Multiple ADO multiple user login Oracle9i jhay0721 Pro VB Databases 1 April 4th, 2005 11:23 AM
Multiple Joins in Multiple Table Search query pookster Access 4 September 23rd, 2004 03:04 PM
Updating multiple Rows from multiple fields in ASP vdm_nana SQL Server ASP 0 April 1st, 2004 04:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.