Access Query

I have a table with data on account number and holder name fields. I need to extract two types of information:
List of most recent option by account from holders of the account
111 AAA 2 15/10/2013
111 BBB 1 15/10/2013

On an account level, the different options selected independently from the holder.
111 2 1

Please find file attached.



Your help would be greatly appreciated.

Thanks,
dnt
Sample17102013.accdb
dnt2009Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You'd have to give us more to go on. For example, do you ALWAYS want the first 3 characters extracted? And then you also want the value in the 9th position extracted?

Or do you want everything preceding that last Date value extracted up to the SECOND space character (from the END of that string)?

In other words - you have to more clearly define the rules you have in place for extracting the data before we can really help.

It's easy to grab the first 3 characters of a String. In a query, you'd do this:

SELECT YourField, Left(YourField, 3) AS [First_Three] FROM YourTable

You can use the Mid function to grab items as well:

SELECT YourField, Mid((YourField, 1, 3) AS [First_Three] FROM YourTable

To grab the 9th character:

SELECT YourField, Mid((YourField, 9, 1) AS [Ninth_Char] FROM YourTable

Here's more info on those functions:

http://office.microsoft.com/en-us/access-help/mid-function-HA001228881.aspx
http://office.microsoft.com/en-us/access-help/left-function-HA001228873.aspx
0
als315Commented:
Try this query:
SELECT Table1.ID, Table1.AccountNumber, Table1.HolderName, Table1.Option, Table1.DateOption
FROM Table1
WHERE (((Table1.DateOption)=DateValue(DMax("DateOption","Table1","AccountNumber=" & Chr(34) & [Table1].[AccountNumber] & Chr(34) & " And HolderName = " & Chr(34) & [Table1].[HolderName] & Chr(34)))))
ORDER BY Table1.AccountNumber, Table1.HolderName;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.