Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 19th, 2003, 10:51 PM
CadManXtream CadManXtream is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Delaware
Posts: 9 CadManXtream User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question How do you link Access Sub Table to VB ADODB?

I am furiously searching for a way to link Several Access sub-tables to be used on
VB?

In general I have Several Machines and all are listed on a table in Access. Each row of in this table
has a machine with all the parts listed within a sub-table.

How can I link the table so i can setup datacombo box fropm the subtables?

Beware i am a newby with limited knowledge. I have read through 3 different books and spent an average of 18 hour days for 4 days now and can't figure it out..... Please is there a way to do this?

Reply With Quote
  #2  
Old July 22nd, 2003, 03:51 PM
lmck lmck is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 4 lmck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Probably the easiest way is to use the Data Environment Designer. You need to have ADODB installed. Add a reference to the Microsoft Data Environment Instance to your project (Project->References). Also add a reference to the Microsoft ActiveX Data Objects. In your project explorer, right click on the Data Environment and select view Object. In the new window, right click on the Data Environment object and select Add Connection. Right click on the new Connection and select Properties. In the dialog, select your Access database.

Now, right click on the connection you just created and select Add Command. Right click on the new Command and select Properties. For Database Object, select Table. Select your main table (machines) as the Object Name and apply.

Right click on the Command and select Add Child Command. Right click on the new child command and select properties and select your related table (machine parts) the same way you did the parent table. Click the Relation tab. If the two tables have a field name in common (like MachineID) it will already be shown for both tables - otherwise, select the related fields. In either case, click Add to add the relationship and apply.

Now, your two tables are related. I would use the Hierarchical FlexGrid for display (Right click on toolbox->components->Microsoft Hierarchical Flexgrid (OLEDB).

Place a FlexGrid on the form and select it. Hit F9 (Properties). In properties set the DataSource property to your Data Environment Object from the drop down and set the DataMember property to the command object for your Parent table.

Now right click on the grid and select Retrieve Structure. Now right click on the grid and select properties (it's different from hitting F9) These are the special properties for the FlexGrid. Here on the Bands tab, you can select which fields to display. Band 0 will be your Parent table and band 1 will be the sub table fields.

When you run the project, the grid will be populated and you can click the Plus/Minus signs on each row to shoe/hide the sub table fields for each machine.

Whew! Hopefully, I haven't left out any important steps. You could do this all theough code, of course, but using the Data Environment Designer takes care of all the dirty work for you, it's all point and click.

You can use other data controls DataCombo, etc. (Make sure to select the OLEDB versions), but you may have to write some code to synchronize them as you move through the parent table.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > How do you link Access Sub Table to VB ADODB?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway