Reports :: Select Most Recent Record From A Table That Is Linked To Another Table

Jul 13, 2014

I have a basic database design, well I think so anyway. It only has two tables:

1. tblClientInfo
2. tblNotes

Basically each client has multiple notes/comments that can be linked to its record, hence the tblNotes table. The two tables have a one-to-many relationship, being that each customer can have many notes.

I then have two forms:

1. Claims Loss Form
2. tblNotes_DatasheetSub1

So I can enter multiple notes for each customer. The problem I am having is with the report output. It wants to print every note (record) that is linked to the customer. I just need it to print the most recent note for each customer (It would save a lot of wasted paper).

Example of a print out of what it is doing:

John Doe - 123 Easy St - Notes 1 (Most Recent Note)
John Doe - 123 Easy St - Notes 2 (Previous Note)
John Doe - 123 Easy St - Notes 3 (and so on...)

It is printing duplicates of the same customer by adding the additional notes for that same customer on a new line.

How can I tell it to only print the customer one time in the report, and most importantly, to only use the most recent note that is linked to the customer?

I tried using DMax("NoteDate","tblNotes"), but this only returns one customer with one note. I need it to do that for each and all customers.

I have successfully ran a subquery (two queries with one linked to another) by following detailed instructions from this page I found: [URL] .... It works, but the problem is it only shows the latest date for each note, not the actual contents of the note. I feel so close with this option, but so far at the same time.

The TOP n records per group looks promising that I found here: [URL] ...., but I honestly don't know how to implement it correctly in my SQL. I am very much still learning Access and apparently have stumbled into something that is much more complicated than I had originally imagined. I just assumed I could filter the duplicates out, or tell access to print the last or most recent note record for each customer.

View Replies


ADVERTISEMENT

Queries :: Appointment Database - Query Most Recent Entry For Each Record In Separate Table

Jun 20, 2013

I have a database that is used to allocate appointments to our staff. It has 2 tables, one that lists the clients we need to call in that day, and another that stores details of each contact attempt. I'd like to design a query that find all clients who we have not dealt with so we can easily get their details in a list. I know what the criteria for the query would be, but I'm stuck for how to actually execute it. Here are the details.

Table tClients stores the current clients - primary key is named "clientRef"
Table tContactEvents stores each contact attempt and the date/time is stored in a field named "dateTime".

When an entry has been dealt with successfully a yes/no field named "completed" will be set to "Yes".

There may be many attempts to contact a specific client on a given day, unsuccessful attempts will not have the completed flag set.

Once the completed flag is set that client will be ignored so no further entries will appear.

So I need a query that searches tContactEvents for the most recent match to each number in tClients.clientRef and checks if the completed flag is set. If the completed flag is false, or if the number has no match (i.e. no contact attempts made yet) then the clientRef should be displayed. I also need this to be restricted to the current date, as the same client could have rebooked their appointment to a different day.

View 10 Replies View Related

Combo Box Based On Linked Table Needs To Pull Info For Sub-Form From Non Linked Table

Aug 31, 2007

I am trying to build a Form that will show an estimate (then eventually will be moved to a project if customer and employee aggree to price and project) in a Form F_Estimates is a M_Customers(Customer_ID) (Based on a Table) and thier info in a Subform. Also is the "projected costs" from parts out of the Parts(Part_ID) (Based on another Table) in a second Subform as a list that I need to calculate $$$ in
(Dang that still sounds evil and definately NOT understandable even after edit... so)

Here's some basic info

Tables

EstimatesandParts - Table
EstimatesandParts_ID : Autonumber
Estimate_ID : Number
Part_ID : Number

Parts - Table
Part_ID : Autonumber
PartNumber : Text (not a number due to some part#s have letters in them)
PartName : Text
Unit Price : Currency
Description : Text

Estimates - Table
Estimate_ID : Autonumber
InvoiceNumber : Text (again can have letters in it)
EstimateDate : Date/Time
EstimateTime : Date/Time
Employee_ID : Number
Customer_ID : Number
ProblemDescription : Memo

Customers - Table
Customer_ID : Autonumber
FirstName : Text
LastName : Text
CompanyName : Text
Address : Text
City : Text
Province_State : Text
Postal_ZIPCode : Text (CDN Postal codes are letter num letter...)

you can see the link table in the EstimatesandParts Table

Now I want to use that link to populate a subform in the F_Estimates form

Forms

SF_Customers - SubForm

(all boxes atm are text boxes on this form till I figure out the Parts section then will use same base for this so I can pick any customer in the database to be the customer for this estimate. Also will have ctrl button for making new customer with customer form and a refresh on Focus Gain bit of code)

FirstName
LastName
CompanyName
Address
City
Province_State
Postal_ZIPCode

SF_Parts - SubForm
Default View -Continuous Forms

(want it to be a list of parts that I can grab prices and descriptions from then in a bit of code to calculate a cost of parts)

Part_ID : Combo Box
Control Source - Part_ID
Row Source Type - Table/Query
Row Source - SELECT Parts.Part_ID, Parts.PartNumber, Parts.PartName, Parts.UnitPrice, Parts.Description FROM Parts ORDER BY Parts.Description;

(Pulls info from the table Parts for input into a list of parts to be used on that project)

PartName : Text Box
UnitPrice : Text Box

(here's where I run into problems due to the fact that the form is not based on the parts table but rather the link table EstimatesandParts so I can't propogate the info to the 2 other text boxes, ps I dont care if they cant be text boxes and have to be linked or some other type I'm not "set" just need to find out how to make it work )

(have tried a couple things to complete this task)

Me.txtPartName = Me.Part_ID.Column(2)
Me.txtUnitPrice = Me.Part_ID.Column(3)

(works AWSOME ... for ONE ROW then propogates the second selection to the first and second and third selection to first second and third and so on ...)

(tried to make control source for the txtPartName to)

=Forms!Parts!Partname

(Doesnt exist .. akkk, cant use ActiveForm either as it doesn't focus on the SubForm but the MainForm ... cry)

F_Estimates - Form

Estimate_ID
InvioceNumber
EstimateDate
EstimateTime
ProblemDescription

(all basic Text Boxes)

Employee_ID
Customer_ID

(Combo Boxes Select Customer and Employee from list of present ones of each)

SF_Customers
SF_Parts

(Both SubForms on the main form)

Now this is an Exerp from my entire Database I like to work on one small problem at a time and I have made this its own little database till I figure out the problem then I will bring the info I learn back into the rest of the database and go from there ...

Hope you can help I have a feeling I will need to make a recordset and go from there but I'm just not able to wrap my head around that for some reason

Thanks in advance for ANY and ALL help that I get from here

View 10 Replies View Related

Get One Record In A Linked Table

Jul 26, 2006

I created a database that performs certain functions ("functional database") and I want to archive the changes I make to that database's structure in a central repository that is nothing more than another database ("repository") that I will create to track all of the revisions made to the 80 or so databases within my department.

I would like to create a link on the main form in the functional database that will, on click open the specific record in the repository database that refers to the revisions previously made to the functional database.

Any suggestions? Thanks in advance for your help.

View 1 Replies View Related

New Record In Linked Table

Jan 19, 2006

I am getting the error RunTime '2105' You can't go to the specifed record.

Just converted my test database to read from a sybase linked table rather than the development local table. It reads fine but the new record button now gives the above error. I presume I need to code myself a new record function . . .

Is this what I have to do, and if so, what's the best (and quickest!) way of going about it?

thanks

Dave

View 1 Replies View Related

Can't Add New Record In Linked Table In Windows 2000

Dec 4, 2005

Hi,

I developed a database in Access 2000 on an XP SP2 machine with linked tables to another Access 2000 database.

Everything works fine using my machine, but when a user running Windows 2000 uses the database, they cannot add a new record to the linked table (either directly using the datasheet or a form). Running a query on the table also did not let me add a new record.

I have searched the MSDN libraries, but I wasn't able to find anything.

Any help much appreciated.

View 1 Replies View Related

General :: Adding A New Record To Linked Table

Aug 5, 2014

I have several tables that are linked that I need to be able to add to. This is an example of the structure:

Patient Info
ID
FK_Ward - ID of Ward table
FK_Room - ID of Room table
FK_Cond - ID of Condition table

Ward
ID
WardID

Room
ID
RoomNumber

Condition
ID
Description

Unfortunately, its not the exact one as I can't post that here! What I am trying to do is to add a new patient record using information from the other tables as guides - e.g. the user selects the name of the Ward but the ID in the Ward table is entered, the User selects the number of the room but again the ID in the Room table is entered, and for the Condition same thing. So I would like to have dropdowns (or ComboBoxes) for each of these and based on the user's selections add a new record to PatientInfo using the ID values as links.

View 4 Replies View Related

Rats! - "select...into" Replaced Linked Table

Oct 10, 2007

Hello folks,

I am looking over a mdb that I recently took over and found a problem.

There is a query that does a "select...into" a table, which obviously replaces the original table with the new records from the select statement.

Ok, but... The table is supposed to remain a linked table. The query currently replaces the linked table with a local table viewable only by the locally running mdb.

QUESTION: Is there a way to set up a select into statement to replace a linked table with another linked table?

I found:

dim mydb as database
set mydb=currentdb
mydb.execute ("INSERT INTO Table1( [Field1], Field2, [Field3] )
SELECT [Field1], Field2, [Field3] FROM Tablename IN 'c:foldernamedatabasename.mdb")

Which could do the trick, but I would prefer not to hardcode the path to the network data.mdb. Maybe I could query the path of the table and use that into the above... Ideas? Just now thought of that...

I figured I would ask before I rewrote the query to merely update with new records and then delete old... or delete all then update/insert with all new...

Ideas?

Thanks!

View 2 Replies View Related

Tables :: Finding Specific Record In A Linked Table

Jun 19, 2013

From what I have read, I understand you can't use the seek command on a recordset from a linked table from another database. Is that true? If so, what is the alternative to find a specific record in the table using an indexed field?

View 4 Replies View Related

Select Record From Table For A Report If...

Sep 7, 2004

Hello! I am building a report that tracks excessive call-in's for my hospital's employees. Data is entered into a form which then is stored in the table (duh!) "Call-In's." I have a query that lists all those who have more than 5 call-in's.

Here is the problem: In order to get the sum of callin's per person, I did a totals field in my original query and counted on Name. But now I needed to know the sum of each person's, and so I had to do a cross-tab query that included the name, department, the count (from the first query) and then I summed on the count field. What a mess, right? Also, I added a field for If >5, Yes, No.

I based my Excessive call-in's report on the final (above) query. Like this:

Call In's table
Name, Department, Date of Call in, Call in type

Call-in's query
Name, Department, Date of Call in, Call in type, Count of Name

Call-in's crosstab
Rows: Name (GROUP BY), Department (GROUP BY)
Columns: Count (SUM) and total of Count (SUM)

Excessive Call-In's query
Name, Total of count, iif >5, Yes, No

There are already 54 records in the table, one of which has excessive call in's (more than 5).

Is there a way to run a report that not only lists the person's name and number of call in's but also the date of each one and the call in type? Both of these are fields in the call-in's table.

When I try to combine my Call-In's query with my Excessive Call In's query I get the matrix. Example: I get the same record for however many callin's they have. Thank for your help. I'm so sorry this is complicated. I've got to be doing something wrong, or at least inefficiently. Does any of this make sense? Thanks again.

Kelly (the clueless, but I'm trying)

View 3 Replies View Related

General :: Select A Record From Table

Jun 6, 2013

I am trying to run a sql statement in vba in which it selects all the records in a table related to a order Id number. I then want it loop through all the records and check for a check box which is selected. if its selected then "A" variable becomes "1" and i will then run a if statement saying if variable is 1 then run this code else run code b.

The problem I am having is that if there are 4 records the code checks through all of the 4 records and keeps changing the variable so

record 1 variable is 0
record 2 var is 0
" " " 1
" " " is 0

so although the records for a given order number does have a checked box the code wont recognise that.

What I can do or what code I can add my minds gone all blank on this.

View 2 Replies View Related

Problems With A Linked Table -not Finding Record In Asp Login Page

Jul 19, 2007

hi,

I linked a table (front to back) yesterday. I had a user enter information into this table. It's a login table. The login screen of the asp page is not able to find the record, even though I can see it in both tables. I am not sure what's wrong, since both tables show the same information. Does anybody have any ideas?

thanks in advance.

View 2 Replies View Related

Form - Record Source - Select A Table

Nov 13, 2013

Form - record source - select a table that when the user enter a value in the field of the form it gets place into the designated table (select a table). my problem is that I have two fields in the form, one field from the data entry is suppose to go to the train table,and another field the data entry is suppose to go to the station table. if I have the form's record source have a designated table for the data entry.It doesn't have two tables for the data entry.

View 13 Replies View Related

Queries :: Select Active Record In A Table Using A Query

Nov 30, 2013

Based upon a specific date (varDate), I want to select the record that is active (who drives the lease car).

row 1 user X from 13/11/2013
row 2 user Y from 15/11/2013
row 3 user Z from 17/11/2013

I want to find the active user on a date. So on date 13/11/2013 (=varDate), user X is active, on 14/11/2013 (=varDate), user X is still active, on 15/11/2013 (=varDate), user Y is active, on 16/11/2013 (=varDate), user Y is still active and on 17/11/2013 and later, user Z is active.

View 1 Replies View Related

SELECT Query To Not Include Record If Already Exists In Another Table

Aug 25, 2015

I have 2 tables:

Query_Rates (Actually this is the result of a query):
Unit
R_Date
Sold_Rate
A
24-AUG-15
145

[code]...

So what I want is a list of all the records from the Query_Rates table where the absolute differences between the sold rates between Query_Rates & [Sent till date] (matching the unit # and the dates) is greater than 1 and the record shouldn't be displayed if it is already present in the [Sent till date] table. But if you notice the first record which has unit A is already mentioned in the "Sent till date" table and shouldn't be repeated again in the query result.

The desired out put should be:

Unit
R_Date
Sold_Rate

X
25-AUG-15
200

View 3 Replies View Related

Reports :: View One Record From Master Table And Many Record From Slave Tables

Dec 23, 2013

I have got problem with ms access report. I want to make a report which is based on

1) first master table
2) first slave table
3) second slave table

I have done some research and decided to do some form with subform. So I have got the view one record from master table and many record from slave tables in one view.

But it turned out that it has become duplicate records. (the relationship are ok - it duplicate master record as many as slave records)

So:
1) how i can do ms access report from multiple tables - one master record with multiple records form slaves tables

View 5 Replies View Related

Modules & VBA :: Allow User To Select Record From Subform And Add It To Table - Insert Statement

Jun 18, 2013

I have a sub form with staff records on it within a main form. I am trying to allow the user to select a record from the sub form and add it to a table, here is my code which, to me, looks correct. However it gives me an error saying "Syntax error in INSERT INTO"

Code:
Private Sub Command3_Click()
Dim dbs As Database
Dim sqlstr As String
Set dbs = CurrentDb
Forename = Nz(Forms!frm_Capex_Submission!frm_staffSub.Form.shy_forename, "")
Surname = Nz(Forms!frm_Capex_Submission!frm_staffSub.Form.shy_surname, "")

[Code] ....

View 1 Replies View Related

Retrieving The 5 Most Recent Records From A Table

Nov 14, 2006

Hello,

I have a table with part orders and I want to retrieve my five most recent orders in a query. That means I'll need the 5 most recent orderids How would I mention that in my criteria?

Kind regards,
Hans

View 1 Replies View Related

Query The 3rd Most Recent Item From A Table

Oct 18, 2007

I have a table with a DateTime field. I would like to create a query that queries only the 3rd most recent record in the table. So there would only be one record per ID. If there is only two records for an ID, it would show nothing. I have tried a few things already, but none of them have worked quite right. I was wondering if anyone had a new idea.

View 11 Replies View Related

Kinda Like Recent Post Macro Updates Table

Aug 13, 2007

ok i have this query.
Code:UPDATE [Claims Header] SET [Claims Header].status = 'I'WHERE ((([Claims Header].Claim_ID)=[claim id]));WHERE ((([Claims Header].Claim_ID)=[claim id]));
i want to have a button that runs this query but how do i pass over the claimid from my form? also when it's done running the query i want it to run a report.
so i was trying to make a macro, but how do i tell the macro to find the claim id from the form?

View 1 Replies View Related

General :: Copy Data From Local Access Table To Linked SQL Server Table?

Jan 13, 2014

I have an MS Access accdb with linked SQL Server 2012 ODBC tables. I am working on a procedure to copy data from local tables to these linked tables (identical schema). I did a simple

Code:

DoCmd.RunSQL "INSERT INTO linkedTable SELECT * FROM localTable"

This works, but is very slow. Way too slow. (INSERT copies the data one record at a time).

I would like to copy the data in a bulk operation, or operations that I can execute programmatically.

View 1 Replies View Related

Tables :: Multiple Parents Table Linked To Child Table - Primary Keys

May 28, 2015

I have a table for a multiple parents linked to a child table. I need to figure out a way to only allow 1 parent to be coded as primary, 1 as secondary, and then the rest as other... I thought about making Primary/Secondary/Other a primary key. But then I can only have 1 other. I would have to make a finite number of parents that could be entered and I want an infinite number.... My end goal is to have a report that only has a primary and second parent on it, but the rest of the parents still exist in the table...

*Child_ID
Parent_First_Name
*Primary/Secondary/Other

View 8 Replies View Related

Select X Number Of Most Recent Records

Apr 1, 2014

I have been tasked to determine the actual cost to build a product by summing the cost of the most recent required components to come off of our assembly line. For example, say I'm trying to determine the cost of a car with multiple sub-components (1 engine block, 4 doors, 4 wheels, 2 headlights, etc.). We make parts for all kinds of products (cars, boats, televisions, etc.). All of the data for ALL of these parts are contained in a table called PART_DATA (i.e. part ID, date started, date finished, hours spent, etc.).

Then I have a list of parts required to build a certain model car in a table called CAR_PARTS_LIST. This table contains data like (part ID, quantity needed, etc.).

If I want to know how much it would cost to build a car using the most recent car-part data, I need to pull data for the most recent required car parts to come off the assembly line that are required for a single car. That is, my car needs 4 wheels, so I need data for the most recent 4 wheels to come off the line.

How can I write a query for the "4 most recent wheel records" given that "4" is specified in the CAR_PARTS_LIST?

View 1 Replies View Related

Extracting Data From Linked Db2 Table Using Access Make Table Query

Aug 29, 2006

Hi,
I am extracting data from linked db2 table using access make table query. First I create a select query and can view the linked db2 data, but when I change to a make table query I get an error message, "invalid argument", when I run the make table query. There is no selection critera specified. Has anyone had this happen? and Do you know a solution?

Thanks for your support
GinnyP

View 1 Replies View Related

General :: Possible To Have Data From Linked Table Automatically Update Into Existing Table?

Aug 17, 2012

I have one DB that is used for creating/storing customer ID's, and another DB that is used for creating/storing job information for customers.I have linked the table from the customer DB to the job DB.

There is a table in the job database that holds customer name and ID, and some VBA that generates unique job codes.

Is it possible to have the data from the linked table automatically update into the existing table?

View 1 Replies View Related

Tables :: Make Calculated Field In One Table That Calculates Values From Another Table Linked By Order ID

May 13, 2015

I have what is probably a stupid question but I've been struggling with this one for a while. I have an ordering database which has an Orders table (containing Order ID, Date, Supplier etc) and an Order Line table within which I have a combo box for Product name, supplier, price, VAT rate, Line price etc. At the moment, I have the order line table as a subform within the Order form (run from the Orders table). The problem I'm having is the subtotal and total fields. At the moment these are in the Order Line table as I cannot figure out how to get these in the Orders table. In summary, can I make a calculated field in one table that calculates values from another table (linked by Order ID)?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved