truth_ip
09-23-2002, 06:10 AM
I really need some help here!
I have a database in access and we are making queries to display the most recent data (using the "max" function for ID) but when the query is run we cannot get the information to match up with the proper ID number. How do we link the entire set of data to a specific ID number?
Thanks for the help!!
Alex and Jenny
Fizzio
09-23-2002, 06:23 AM
This depends on how your data is structured. What exactly do you mean by link the entire set of data to a specific ID number?
In order to show the data pertaining to one record, you must have a relationship set up between the tables storing the data, linked usually by an ID field.
truth_ip
09-23-2002, 07:20 AM
we have a database with an independent ID number, a first, and a last name for each piece of information... we are trying to create a system that will display a report with ONLY the most recently entered set of data (ID number, name)...
Our end goal is to have a form that will collect the data, save it in the database, and be able to print out business cards for the last person whos data was entered. The problem we are having is that we cannot run a report that will display just the latest piece of data and we don't want to print out ALL the data, just the most recently added data. We are trying to filter the data with a query so we can run a report from this query... All we need to know is how to filter just the most recently entered data in a query that displays all the correct information (relative to the ID number)...
I hope this helps...
Thanks again!!
Alex and Jenny
Fizzio
09-23-2002, 07:34 AM
If you want to do this via a query, use this format of SQL code
SELECT TOP 1 TableName.ID, TableName.ForeName
FROM Contacts
ORDER BY TableName.ID DESC;
Or if SQL is not your forte (as it isn't mine!), go into the query design grid, add the tables and fields, sort the ID field in descending then in the query properties, set the top values to 1.
This sorts the ID field in descending order and then picks the top 1 from the table
HTH