473,396 Members | 1,846 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.

Displaying result of query of secondary table within a single form

Hi there,

I'm something of a newcomer to MS Access so it's more than likely that my question is extremely elementary.

I have a form whose record source is a single table in my database. It's purpose is only to display in sequence,every record in this table. Trouble is, one particular field in this table (tblAttendees) is a foreign key in a foreign key - primary key relationship to a field in another table. The foreign key, is of datatype "number" and so it obviously corresponds with another number field in the parent table which is a primary key.

My problem is that rather than simply display the field's value for every record which would be simple enough and would of course simply be a integer, I want to be able to access the value assigned to another specific field in the particular record the foreign key points to in the parent table. Given that I don't know how to assign mutliple record sources to a given form or if it is even possible, I don't know a solution to my problem.

At the moment, I have a label box that in design view, has the following syntax:

Expand|Select|Wrap|Line Numbers
  1. ="Attendee:" & [intTitleTypeID] & " " & [txtAttendeeFirstName] & " " & [txtAttendeeSurname]
The [intTitleTypeID] field is the foreign key. Given that I can't access the parent table, I can't actually access the field name within the parent table either.

Any suggestions as to how I might solve this? Can you embed the result of a query of another table within a label box in a form for example?
Dec 10 '07 #1
5 2442
JustJim
407 Expert 256MB
Hi there,

I'm something of a newcomer to MS Access so it's more than likely that my question is extremely elementary.

I have a form whose record source is a single table in my database. It's purpose is only to display in sequence,every record in this table. Trouble is, one particular field in this table (tblAttendees) is a foreign key in a foreign key - primary key relationship to a field in another table. The foreign key, is of datatype "number" and so it obviously corresponds with another number field in the parent table which is a primary key.

My problem is that rather than simply display the field's value for every record which would be simple enough and would of course simply be a integer, I want to be able to access the value assigned to another specific field in the particular record the foreign key points to in the parent table. Given that I don't know how to assign mutliple record sources to a given form or if it is even possible, I don't know a solution to my problem.

At the moment, I have a label box that in design view, has the following syntax:

Expand|Select|Wrap|Line Numbers
  1. ="Attendee:" & [intTitleTypeID] & " " & [txtAttendeeFirstName] & " " & [txtAttendeeSurname]
The [intTitleTypeID] field is the foreign key. Given that I can't access the parent table, I can't actually access the field name within the parent table either.

Any suggestions as to how I might solve this? Can you embed the result of a query of another table within a label box in a form for example?
This is where relational databases become fun and addictive!

You need to design a query, using both tables (linked by their PK/FK relationship) and pick the fields you want to be on the form from either table.

Now make that query the table's recordsource and drag fields to your heart's content.

Have fun but don't stay up too late!

Jim
Dec 10 '07 #2
This is where relational databases become fun and addictive!

You need to design a query, using both tables (linked by their PK/FK relationship) and pick the fields you want to be on the form from either table.

Now make that query the table's recordsource and drag fields to your heart's content.

Have fun but don't stay up too late!

Jim
Jim,

Are you saying that the record source should be an entire query that would query both tables thereby giving me access to whatever fields I needed? If so, what you're saying would make sense.
Dec 10 '07 #3
This is where relational databases become fun and addictive!

You need to design a query, using both tables (linked by their PK/FK relationship) and pick the fields you want to be on the form from either table.

Now make that query the table's recordsource and drag fields to your heart's content.

Have fun but don't stay up too late!

Jim
Jim,

I've done exactly what you suggested and it works perfectly. THANK YOU!!
Dec 10 '07 #4
alpnz
113 100+
Jim,

I've done exactly what you suggested and it works perfectly. THANK YOU!!
Search for DLookup in the help system, You will find help that documents another great way to display related information, using VBA code, great for just one off situations, and or conditional display. E.g. only display the information, if the criteria of a series of Dlookups is true or false etc etc.
Welcome to the disease ... As Jim pointed out, this is where relational Databases get addictive.

Hi all ... yes yes I know its been nearly a year in excile, but then its the crazy season again .... heh he
Dec 10 '07 #5
JustJim
407 Expert 256MB
Jim,

I've done exactly what you suggested and it works perfectly. THANK YOU!!
My pleasure. Sorry about missing your second question, being on the "Far Side" of the world in relation to most people on this list, means that I miss the busy period.

Enjoy

Jim
Dec 10 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mark ??;-\) | last post by:
I would like to display a listing of files on a web page as follows: If there is only one file: display the section name and then display the current file. If there is more than one file (for...
6
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form...
4
by: John Baker | last post by:
Hi: Most of the time when I do a query and it has no matches, there is a single blank line in the result that I can test. I have one query where no result produces a response with NO lines at...
4
by: ED | last post by:
I am attempting to to write a query that has a numerous nested IIf statements. The problem that I am having is that it is to long of a query to be built in design mode and when I build it in sql...
8
by: Jon Weston | last post by:
I'm setting up an Access2003 database with pictures. I put a bound ole picture ctrl on a form that's source is the table that contains the pictures and follow ALL the directions for embedding a...
1
by: hafner | last post by:
Hello, I'm building a query in which a master set of data is linked to a secondary table with the use of a unique identifier. Basically, I'm looking to represent in the query whether or not...
0
by: Dorish3 | last post by:
Hello. I have to apologize in advance but I am a newbie with Access. I have a select query of which I would like the other select queries that I create to be dependant on the first query....can...
4
by: esmith2112 | last post by:
I have a query running on a federated database that takes the form select col1, col2 from nickname1 where <conditions exist> union all select col1,col2 from nickname2
11
by: dba | last post by:
Have been displaying data from database using html for some time but just recently trying to display data back to "form". Can't find answer. <form method="post" action="<?php echo $PHP_SELF;?>">...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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:
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.