473,396 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Record Source (Multiple Tables) No Relationships

I have 2 tables: Table1 and Table2.
Neither one has a primary key because each table will only have
1-record.
My form is a SingleForm unbound with tabs (my desire here).

Using this form, in the Record Source I originally had the statement
TABLE1,
and all worked fine. Now I want to open the second table as well, and
this is where my problem is.

In the Record Source I tried TABLE1,TABLE2, [TABLE1].*,[TABLE2].*,
SELECT [TABLE1].*, [TABLE2].* FROM [TABLE1], [TABLE2];

None of these work! The last example shows the form but with no
controls.
Is there a way to simply open two tables (all fields) using the Record
Source
knowing that each Table will only be 1-record with no relationships???

Thanks Greg

May 8 '06 #1
6 10435
I honestly don't know why you'd want to do something like that but:

SELECT Table1.* FROM Table1
UNION SELECT Table2.* FROM Table2;

as the RecordSource will work.

Of course, your tables need the same field names or they must be
selected using the AS keyword to make them the same.

May 10 '06 #2
DFS
Jamey Shuemaker wrote:
I honestly don't know why you'd want to do something like that but:

SELECT Table1.* FROM Table1
UNION SELECT Table2.* FROM Table2;

as the RecordSource will work.

Of course, your tables need the same field names or they must be
selected using the AS keyword to make them the same.

No. All that's required in SELECT * UNION SELECT * is the tables have the
same number of fields - and even that restriction is easily overcome by
specifying the columns and adding something like 'NULL as Field8':

SELECT Field1, Field2, Field3, NULL As Field7, 'Eight' As Field8 FROM Table1
UNION
SELECT Field4, Field5, Field6, Field7, Null As Field8 FROM Table2

Output: Field1, Field2, Field3, Field7, Field8

Every column can be a different data type as well.

May 10 '06 #3
<I honestly don't know why you'd want to do something like that but: >

Thankyou for the reply. I simply need to be
able to reference the 2-Tables mentioned. What method would you
personally choose to make reference to each tables fields knowing that
each table will only have 1-record and they have no relationship to
each other? These single record tables, are being used to store Setup
information for the application.

Greg

May 10 '06 #4
<Ap******@gmail.com> wrote
I have 2 tables: Table1 and Table2.
Neither one has a primary key because each table will only have
1-record.
My form is a SingleForm unbound with tabs (my desire here).

Using this form, in the Record Source I originally had the statement
TABLE1,
and all worked fine. Now I want to open the second table as well, and
this is where my problem is.


By definition, an "unbound" Form (tabs or no) does not have a Record Source.
You use code to open a Recordset and move values from the recordset to the
Controls to populate an unbound Form. What you describe is a _bound_ form.

You can accomplish what you want simply by creating a Query, adding each of
your Tables as a data source, not trying to use any Joins, dragging down the
fields you want, and using the Query as your Record Source. That will work
ONLY because you have just one record in each Table. If, perchance,
something happens that one or both Tables have multiple records, you'll get
multiple records in the resulting Recordset.

(Using multiple tables without a Join yields a "cartesian product", that is,
each record of each table is paired with each record of the other table.
When you only have one record in each table that yields only one record. If
you had two records in each table, it would yield four records.)

Another approach would be to add a Key field of the same type to each table,
populate each with the same value, and create a join on that Field.

But, yet another approach seems to have been implied in an earlier
response -- combine the two tables into one single table. That ought to work
just fine, unless you have a total of more than 255 Fields of startup
information.

Larry Linson
Microsoft Access MVP

May 10 '06 #5
Larry

Thank you very much for the insight. I'll mull each consideration and
commit.
I'm leaning toward the KeyFields and the consolidation to a single
table methods.

Greg

May 10 '06 #6
"Ap******@gmail.com" <Ap******@gmail.com> wrote in
news:11**********************@g10g2000cwb.googlegr oups.com:
Thankyou for the reply. I simply need to be
able to reference the 2-Tables mentioned. What method would you
personally choose to make reference to each tables fields knowing
that each table will only have 1-record and they have no
relationship to each other? These single record tables, are being
used to store Setup information for the application.


Make a subform for each table. Put a tab control with two tabs on an
unbound form. Embed each subform in one of the tabs.

You'll probably want to do things like turn off .AllowAdditions and
..AllowDeletions in the subforms themselves.

You could also use a single subform control without the tab and use
some method like an option group (perhaps with toggle buttons) to
programmatically swap the subforms.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 10 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ryan Hubbard | last post by:
I'm inserting a record into MySQL 4.0 using Visual Basic ADO. When using the AddNew and Update method I am unable to retrieve the value of a Auto incrment field (Yes I know I can MoveLast but this...
2
by: RAF | last post by:
i'm trying to make report using dataset having two tables in viewer page iam doing rpt.SetDataSource(ds.Tables(0)) rpt.SetDataSource(ds.Tables(1)) CrystalReportViewer1.ReportSource = rpt ...
8
by: Jason L James | last post by:
Hi all, does anyone know if I can create a dataview from multiple datatables. My dataset is constructed from four separate tables and then the relationships are added that link the tables...
3
by: jpr | last post by:
Hello, I know that this is not the rule but need some help. My datbase has three tables: MASTER TEMPLATES FORMS I have a form which is based on a table named MASTER. I have a primary key...
2
by: rlish | last post by:
I have a database with multiple tables that are all linked by a "site id" field. For any given record the site id field is identical within all the tables. Is there anyway to create a form with a...
8
by: fonzie | last post by:
Is it possible to have a data entry form where the information is stored in several different tables (5 or 6)? I have an inventory database where Table1 stores all of the data common to all...
1
by: access345 | last post by:
I am trying to add a record to multiple tables at the same time. My current Code created multiple records in the same table. I am trying two different methods with no results: Public Sub...
2
by: SteveMPullen | last post by:
I have an Access DB with 5 tables. 3 of the tables have a primary key with a field of "Project Name". I have created a form to add a new "Project Name" to the 3 tables. When I add the new "Project...
4
by: knix | last post by:
I have this access project consisting of multiple tables that are linked together in a relationship. I would like to migrate the consolidated information through appending in a datasheet form or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.