Discussion Locked

Master/Detail Form in VB w/three tables

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am a novice VB programmer and need to create a master/detail form similar to the one created by the Forms Wizard dialog box, only I need to bring in info from three tables, not two. Basically, I have joined three tables, and the one table is linked to both, respectively by their pkey id's.
Please advise with step-by-step details. How would I add a third table? Thanks much in advance.

5 replies

by john_wills

1. Open the form in design mode.
2. In the properties box for the form click the 3 little dots(which may not appear until you click) to the right of the Record Source entry(under the "Data" tab). A query will appear in design mode. The higher part of the display will show the tables and their relationships; the lower part is a left-to-right list of the variables the query yields for use by the form.
3. In the query design observe your extant tables. In the toolbar is a yellow plus(+) sign above a box shape meant to represent a table. Click on this box. The Show Table window will appear, with lists of tables and queries.
4. Highlight the name of the table you want to add to your query(and so to your form). Click the Add button. The tablewill appear with the tables you already have.
5. Click the Close button in the Show Table window. The window will disappear and you will be able to do things with your tables.
6. Some links may appear automatically. You can construct more by clicking and dragging an item in one table to the corresponding item in another table.
7. You want some items from your new table to appear in the query and so be available to your form. Click on each such item's name in the table diagram and drag it to the list of items. A short description of the item will appear in the list at the place you indicate.
8.If you click the exclamation mark in the tool bar you will see the data which will be made available to your form.
9. Alt F/C to get back to thedesign view of your form.
10. On the design view should be a tall box containing a list of the items yielded by the query and so available to your form. Click on each item you wish to use and drag to the desired position in the form. A control box will appear with suitable characteristics, along with a label.

by shanghai sam

Problem: I have been thinking of Access, within which I write a lot of VB. When writing VB straight, things are simpler, and therefore more difficult. Instead of going from the Record Source entry to a pliable table diagram, behind which SQL lurks, in VB6 you actually change the SQL in the Command Text of the Record Source entry, setting Command Type to adCmdText. As in Access, it is common to have a table name there, and as in Access one can have an SQL statement there. If you inspect the SQL which the Wizard has constructed for you, you will find two table names after FROM: put your new table name in. Then, in the list of items after SELECT, insert the names, with table names before them if any ambiguity is possible, of the items you want from the new table. I am afraid I am not fluent in pure VB, although I have done some work in it, and most of the details I have given you for Access do not apply. My bad.

by rsp05

I really appreciate your response. Are we talking about VB 6.0, b/c there seems to be no RecordSource unless I click on the ADODC control, which doesn't look like what you are describing...Am I doing something wrong? Can U clarify. Thx, again

This discussion is closed to new replies.