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 Replies


ADVERTISEMENT

Retrieving The Right Amount Of Records

Dec 6, 2005

I have a table containing the following two fields, one with monthly dates (end of month plus year) and one with profits (per month). However, for some dates the records are missing. For example, for the 31-1-1994 there is no record (not in the date field, nor in the profits field).

How can i create a query that will only show me the records if 10 or more monthly subsequent profits are known, so meaning that in those 10 months no records are missing? So that only the timespans without the gaps (missing records) are shown.

So if the 31-1-1994 and the 30/6/1994 record are missing, then the 4 subsequent records in between those two dates should not be shown,, since the amount of records is not 10 or more. However, if the next missing date would be 30/6/1995, then all the 11 subsequent records between 30/6/1994 and 30/6/1995 should be shown. Since the number of records is bigger than the required 10.

Thanks for helping me out!

Luuk

View 4 Replies View Related

Find Most Recent Invoice And Most Recent Funding For Client

Feb 19, 2008

Hello all

I'm sure the answer is on here somewhere but trying to find it and then getting it to work is a bit of a problem, so i resorted to posting.

I have 5 tables
Partnership Details, Invoices, Funding, Communication, Communication Types.

the field Partnership Name in the Partnership Details table has a one to many relationship with the partnership name on tables: Invoices, Funding and Comunication.

What I want to do is create a query that will show the most recent invoice (detirmined by date) and the most recent funding (detirmined by date) for each partnership.

I can do this using max if I only want the feilds Partnership name, invoice date and funding date. however I want to create a report that will show several feilds from partnership details and I want to show the invoice no. and amount as well as the date and also the amount and notes field for funding

Is anyone able to help?

Thanks
Niyx

View 3 Replies View Related

Display A List Of The Most Recent Records

Aug 31, 2005

hi. i would like this to happen....

i have a database where jobs are entered and the date and times of the jobs are kept in separate Date and Time fields.
to enter a date the user uses this method "30 12 05" and to enter a time like this "21.30"

i would like a query that will display the 10 most recent job additions according to their respective date and times. however, it will not be enough simply to view these records in a report.. what would be ideal is if the 10 records are opened.. in their original form format (goto next record...previous...(1/10...5/10) and the fields are editable like in the default job entry form. this is because after a job record has been added, maybe 20 or so minutes later, that record would need to be retreived as the last bits of information for that record will have been established.

how can this be acheived. i am clueless at the moment, so if there is a solution even resembling this scenario that would be ideal. (if a filter is going to be used...it can be either the 'date' or the 'time' fields, ideally though the query would use a combination of the two to retreive a more exact date to filter the records by)

thank you access world for even considering my dilema.

View 2 Replies View Related

Pulling Most Recent Records For Each Company

Jul 10, 2007

Hello All,
I've searched and searched and can't find anything but it might be because I'm not sure what to search for.

Here is what I'm trying to do. (I'm simplifying this to make it easier to discuss)
I have a table that looks like this:
Company Date Sales
1 5/5/07 $1,200.00
1 6/5/07 $4,200.00
1 7/5/07 $2,200.00
1 8/5/07 $4,300.00
2 5/5/07 $1,200.00
2 6/5/07 $4,200.00
2 7/5/07 $2,200.00
2 8/5/07 $9,200.00
2 9/5/07 $1,200.00

I need to run a query that grabs the last 3 months for each company.

So the correct output from the above table would be:
Company Date Sales
1 6/5/07 $4,200.00
1 7/5/07 $2,200.00
1 8/5/07 $4,300.00
2 7/5/07 $2,200.00
2 8/5/07 $9,200.00
2 9/5/07 $1,200.00

Any help would be appreciated. I'm sure this has been asked in the past so even if you could help me with a keyword to search for, I would be greatful.

Thanks in advance,
Randy

View 4 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

Retrieving Data From A Table

Feb 14, 2005

I have created an expense database but I now want to try to add fields to the main form which will allow the users to select their car engine capacity and the price they paid per litre to establish how much VAT can be reclaimed. A small extract from the table from customs & excise is set out as below (although the table headers have moved a bit). There are 5 engine capacity headers and numerous pence per litre rows.

Pence per litreUp to 1000cc1001 to 1500cc
75.08.5259.653
75.28.5509.682
75.58.5759.710
75.78.6009.738
75.98.6259.767
76.19.6509.795

So if someone had a car with the engine size between 1001 to 1500cc and had paid 75.7p per litre for their fuel we could reclaim VAT @ 9.738p per mile.

Is there anyway I can get access to look up this information for me?

View 5 Replies View Related

Retrieving Data From A Table

Feb 16, 2005

I put this on the tables forum but my answers have now stopped, can anyone here help me with how I get this information to appear on a form....

I have created an expense database but I now want to try to add fields to the main form which will allow the users to select their car engine capacity and the price they paid per litre to establish how much VAT can be reclaimed. A small extract from the table from customs & excise is set out as below. There are 5 engine capacity headers and numerous pence per litre rows.

Pence per litre ....Up to 1000cc.......1001 to 1500cc
75.0 ..................8.525.................9.653
75.2 ..................8.550.................9.682
75.5...................8.575.................9.710
75.7...................8.600.................9.738
75.9...................8.625.................9.767
76.1...................9.650.................9.795

So if someone had a car with the engine size between 1001 to 1500cc and had paid 75.7p per litre for their fuel we could reclaim VAT @ 9.738p per mile.

Is there anyway I can get access to look up this information for me?

.................................................. .................................................
Ans:

It would be nice if you could find out the formulae for working out the pence per mile bit based on the cc.

Either way, I think your table needs changing to this design

Price. . . . CC. . . . . . . . . . . . . VAT
75.0 . . . .1000. . . . . . . . . . . .8.525
75.0 . . . .1000 to 1500. . . . . . .9.653
etc
etc

Col
__________________
This ain't no technological breakdown. . .oh no, this is the road to hell.

.................................................. .................................................

Thanks,

Unfortunately I can't get hold of a formula. I'm still not sure how I would look up a value, even if I changed the table as you suggested. The user would need to select a cc size and then a price per litre which would then need to be cross referenced to give a value. I could set up different tables for each engine size, but then I'm not sure how I could point the answer at the correct table.
I don't even know if what I am trying to do is possible in access.

.................................................. .................................................. .

Sharon, you could have the price per litre in one ComboBox and the engine size in another. Both these would then be the criteria for a query.

Can you post your Db and I'll have a look for you, failing that I could knock one up (in Access97)

Col
__________________
This ain't no technological breakdown. . .oh no, this is the road to hell.

.................................................. ..................................................

I think I've attached the file, but I've never done this before so it might not be there!

The table I'm trying to create is called pence per litre but it is completely stand alone at the moment until I can work out how to get any information out of it. I have changed the table to your suggested layout but have only entered a few records, there are hundreds to be entered if it can be made to work!

Thanks

Sharon

.................................................. ................................................

I can't seem to get the file to attach it doesn't seem the right extention code it's an mdb

View 4 Replies View Related

DIFFICULT - Returning Two Most Recent Records On One Form Line

May 24, 2005

Hi,

This is a toughie (i think so anyway!). I'll attempt to explain!!!

I start with a CONTINUOUS form in my DB that shows all readings for a single given customer's connections. E.g. Customer A has 5 connections and each connection has say 3 readings. Thus this query which uses joins between the Customers, Connections, and Readings tables, would return a list of all readings for each connection, so in the above example: 1*5*3 = 15 records.

Not too tricky so far, but then what I want is for each connection to have just one line showing the latest reading (easily achieved by use of SQL Aggregate Max function on the date field coming from the readings table) TOGETHER WITH the last-but-one (next most recent) reading. So back to the example taking Customer A's connection 1, the row would be as follows:

Cust Conn CurReading PrevReading
A 1 750 500

Where the CurReading value (750) comes from a different record than PrevReading (500).

I've tried all sorts of ways (subqueries etc.) to achieve this without success. The main problem being that any sub query would require parameters from the current record's fields, which seems not to be possible. Can anyone help or is this simply not possible in MSAccess Forms. If it isn't possible anyone have any suggestions as to an alternative way?

Thanks

Darren

View 2 Replies View Related

Modules & VBA :: Retrieving Last Record In A Table

Feb 23, 2015

why the below VBA code is not retrieving the last record in a table.

Dim db As Database
Dim rs As Recordset
Dim i As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("Table_Check_Number_List")

[code]....

View 3 Replies View Related

Filter Query - Report To Only Show Records With Most Recent Date?

Feb 26, 2014

I am having trouble getting a query or report to show only the most recent data.

We have salesmen that use a handheld data collector scanners to count inventory in stores. The scanner data is imported to a Access table. Each record line is one scanned item. I have a query with totals that counts the records and gives me a total count of each item at the store on that date.

I then need to filter the data to only show the most recent date. Using Max Date I get the most recent date but the count fields are showing totals for all dates. I am also getting the unique item from the earlier date in this query which I do not want.

Here is my data table: Inventory Scans from stores.

Scan Date
Item Scanned
location

1/1/2014
item123
Store ABC

1/1/2014
item123
Store ABC

......

Here is my Query with Totals that counts the item records:

Scan Date
Item Scanned
location
(Item Scanned) count

1/1/2014
item123
Store ABC
2

1/1/2014
item 456
Store ABC
3

1/1/2014
item 789
Store ABC
1

2/1/2014
item123
Store ABC
2

2/1/2014
item 456
Store ABC
1

This is what I am trying to get - only the most recent date of counted items:

Scan Date
Item Scanned
location
(Item Scanned) count

2/1/2014
item123
Store ABC
2

2/1/2014
item 456
Store ABC
1

View 5 Replies View Related

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 2 Replies View Related

Retrieving Data From Excel Into An Access Form/table

Aug 3, 2005

Hopefully someone can help me this (and hopefully the solution isn't staring me in the face)

I am trying to export data from a cell in a worksheet to a field in an Access database that I am building. The database has two tables, tblCompanies and tblQuotes. It works through a macro accessed by a command button, which should export the total of a quote into the field Quote_Price in the tblQuotes table, which the users will access through a form. The problem is that if I export the data from Excel, I get an error message saying, "You cannot add or change a record because a related record is required in table 'tblCompanies'. The code looks like this:

Sub NewQuote()

Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As Long
' connect to the Access database
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=C:Documents and SettingsDJEdwardsMy DocumentsTest Foldermarketing.mdb;"
' open a recordset
Set rs = New ADODB.Recordset
rs.Open "tblQuotes", cn, adOpenKeyset, adLockOptimistic, adCmdTable
r = 55 ' the start row in the worksheet
Do While Len(Range("I" & r).Formula) > 0
With rs
.AddNew
.Fields("Quote_Price") = Range("I" & r).Value
.Update ' stores the new record
End With
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub

I can import the cell contents from Access with no problems, but I would like the user to be able to do it from Excel to simplify things.

I'd be grateful for any help!

Cheers

Dave, England

View 2 Replies View Related

Modules & VBA :: Retrieving Single Value From SQL Server Table (DLookup)

Jan 30, 2014

Front end Access 2010, back-end SQL-server 2008 R2.

Normally I retrieve a certain value by Dlookup("myvalue", "mytable",...)

or

strSQL = "SELECT myvalue FROM mytable...;"

Set rs = CurrentDb.OpenRecordset(strSQL, 4)

But is there any faster way to retrieve a single value from an SQL-server table, beside doing doing the select by a stored procedure running through a pass through query, then open a recordset

Set rs = CurrentDb.OpenRecordset("mypassthroughquery")

just to retrieve ONE value?

I could not find something like DLookup("...) for an SQL-Server or in T-SQL.

View 3 Replies View Related

Retrieving Rows From Multiple Table To Fill MS Access Report.

Sep 20, 2006

Hi,

I am using VB.NET 2003 and MS Access XP for a desktop application. While developing the application we have a reached a situation where we want to print a report which retrieves records from four tables. Till here it is easy to think that it can be done by a simple SQL JOIN query, but following is the complexity:

The first table stores a single row.
The second table stores multiple rows related to the Primary Key field defined in Table One.
The third table stores a single row related to the Primary Key field defined in Table One.
The fourth table stores a single row related to the Primary Key field defined in Table One.

The above SAVE RECORD option is performed when a user fills a Form of my application. As stated above, all the four tables are inter-related with a Primay Key field (TNo) defined in table one.

I also have a MS Access Report that will print information retrieved from all the four tables. The Report has some of the fields from each of the above table. The SAVE operation is performed in this way:

(1) A unique TNo is generated for a new record that is about to be created.
(2) All the entries are saved in their respective tables (mentioned above.)
(3) An access query will fetch the records pertaining to this TNo from all the tables to fill the report.

I want to know how to write such a query when I have to fetch multiple rows of a table in between. Is there any way that I can pass the TNO as a parameter to this query that is saved in MS Access?

View 1 Replies View Related

Forms :: Adding Table New Entries With Form Retrieving Data

Nov 15, 2014

I have quite an extensive form linked to a table. When I add new columns to the table I seem to have a problem getting the form to read the data.I have just added a numerical column to the table and added a text box on the form that is bound to it. When I try to pull up the value using VBA it is blank, even though an entry is visible on the form. I have set the text box to general number and the entry shows in the actual table. When typing in the entry into VBA it capitalises where required so it must be registering the table entry. However the value it pulls remains blank.

View 2 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

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

Retrieving Data

Nov 13, 2007

Hi,

I am new to access and need help trying to retreive data. Basically I have a unique ID field (123545). I what a user via a form to be able to retreive data using this unqiue ID. Does anyone know the best way to achieve this in access please?

Thanks

Ket

View 1 Replies View Related

Retrieving OLE Object

Feb 5, 2008

I have an Access2003 database that contains a table. The table has 2 fields. One is a counter and the other stores a picture which is datatype ole object. I want to do a one time export of the pictures. I want to save the pictures as jpegs in a designated directory. I know very little about working with ole object datatypes. Can someone tell me the easiest way to do this?

View 1 Replies View Related

Retrieving The Very Last Entry

Nov 5, 2006

Hello All,

Is there a way to retrieve the very last entry to a table (via a query) without passing a value to the query.

Lets say I have a table Pets

ID desc
==============
1 Dog
2 Cat
3 Lizard

For example lizard was added last, is there a way I could pull just this out using a query? (keep in mind that I don't know wahat the last entry is, so I cannot pass any kind of value to the query)

Cheers,
Aaron

View 2 Replies View Related

Queries :: Query That Will Return Records From A Table That Have Related Records In Another Table

Mar 4, 2015

I am looking for a query that will return records from a table that have related records in another table. Opposite to the Unmatched Query Wizard.I have two tables: tblSupplier and tblSupplierProducts.The two tables are related by the field "SupplierId".I need the query to only return Suppliers that have Products.

View 3 Replies View Related

Retrieving File Size

Jan 17, 2006

Hello all,

I would like, from a form, to get the file size of a particular file.

I would really like something like: FileSize("C: estfile.exe")


I am sure I have had something like this before, but cannot for the life of me find the answer I originally got!

Thanks!

View 3 Replies View Related

Retrieving Ebay Data

Dec 15, 2005

Does anyone know how to setup an ODBC to the Ebay Web Server?

View 3 Replies View Related

Retrieving Values From 2 Subforms

Jul 10, 2006

Hi,
I making a query which creates a list of customers in a month. For the start and end dates of the month, they are retrieved from a table and put into 2 seperate subforms. The query isn't working through, so I was wondering if anyone would see where I'm doing wrong.

In the order_date field in the query, I have this as the criteria:
Between [Forms]![sub_fltStart]![DateList_Start] And [Forms]![sub_fltEnd]![DateList_End]

If you want any more clarification then just ask :)

Cheers,
Ben

EDIT: spelling/grammer

View 2 Replies View Related







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