473,387 Members | 1,669 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,387 software developers and data experts.

Filtering Query

I'm confronted by yet another MS Acess Problem, I'm trying to create a query that will select only the first column of every row; the purpose behind this is because there are more than one record in a given field but I'm only wanting to retrieve the most recent entry. Eventually I would put all the data into a report. Anyone have any suggestions? My view of it is to be similar to an excel spreadsheet.
Mar 20 '07 #1
5 1251
If you are wanting to select just the first column, then use the SQL statement

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tableName.columnName
  2.  
If, however, you wish to select the most recent row, you can use

Expand|Select|Wrap|Line Numbers
  1. DoCmd.GoToRecord , , acLast
  2.  
Mar 20 '07 #2
If you are wanting to select just the first column, then use the SQL statement

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tableName.columnName
  2.  
If, however, you wish to select the most recent row, you can use

Expand|Select|Wrap|Line Numbers
  1. DoCmd.GoToRecord , , acLast
  2.  
For the SQL statement, what I have is a table with a list of names and corresponding columns containing an ID, an organization, and a status. The organization column holds more than one record, so a person could have belonged to more than one organization.

I'm looking for a way to retrieve the most recent record in such a case; I guess when I said the first column I should have said the first record in each selected column.
Mar 20 '07 #3
For the SQL statement, what I have is a table with a list of names and corresponding columns containing an ID, an organization, and a status. The organization column holds more than one record, so a person could have belonged to more than one organization.

I'm looking for a way to retrieve the most recent record in such a case; I guess when I said the first column I should have said the first record in each selected column.
Wait I said it wrong, I need the most recent record from the sub-form which would be the last record in each field. Can you provide some sample SQL code for this? And if possible provide some VBA on how to properly utilize the DoCmd in going to the last record?
Mar 20 '07 #4
Let me see if I understand this correctly:

You have a table with 4 rows:
1) Names
2) ID
3) Organization
4) Status
You want to get the last record added to the database and the organization column can have more than one entry.

Is the organization column in a seperate table linked back to the original through a relationship or is it that you just may have multiple organizations with the same names, IDs, and status' attached to it?
Mar 21 '07 #5
Let me see if I understand this correctly:

You have a table with 4 rows:
1) Names
2) ID
3) Organization
4) Status
You want to get the last record added to the database and the organization column can have more than one entry.

Is the organization column in a seperate table linked back to the original through a relationship or is it that you just may have multiple organizations with the same names, IDs, and status' attached to it?
The names, IDs, and status are in the parent table linked to another table that holds the organization. I found a solution though, what I found to work was to group by the last organization. Thank you though :-)

The new issue I'm having trouble with is calculating a subtotal for the number of IDs (employees) in an organization (so many people in organization A, B, C, etc) and a subtotal for status (so many people that are X, Y, Z, etc). I'm currently researching it right now, but if there's something you can add I would certainly appreciate it.
Mar 21 '07 #6

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

Similar topics

1
by: Alex Satrapa | last post by:
I have a table from which I'm trying to extract certain information. For historical reasons, we archive every action on a particular thing ('thing' is identified, funnily enough, by 'id'). So the...
3
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I...
1
by: Elias Farah | last post by:
Hello All, I hope someone can give me (and other keen access enthusiasts) some helpful information to explain how to most efficiently filter Queries & subqueies. Consider this common simple...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
1
by: S. van Beek | last post by:
Dear reader, How can I filter a numeric field with Like as criteria in a query. To filter a numeric field with <10 as criteria this will com back with the result of those records for which...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
2
by: JUAN ERNESTO FLORES BELTRAN | last post by:
Hi you all, I am developping a python application which connects to a database (postresql) and displays the query results on a treeview. In adittion to displaying the info i do need to implement...
3
by: Shawn Ramirez | last post by:
As with most web applications speed is a huge deal to me in my applications. My customers don't really care if my app is a true 3 tier application or not, they just want it to be faster then it was...
3
by: zandiT | last post by:
Hello I have an access report and im using a query to filter the report using Date parameters eg Start Date-12 May 2009 and End Date-30 September 2009. the query works perfectly. My problem is...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.