I need help doing certain functions in access, that I was able to do in excel. I'm not familiar with the differences in languages so please bear with me. I need to do a sum if and a modified version of vlookup which would also delimit where there are multiple values which match the criteria. This is unnofficially called "vlookupall". See bottom of page for a sample. I need to apply this to a query/ queries in an access database for work. What is the best way to go about this?
Thank you for your help!!! So much!
-------------------
What have i tried?
I think dsum is used for sumif, but i'm a little unclear on how the syntax works, even after reading. An example would be great.
I tried applying dlookup to my query, but i was unable to figure it out. Also I run into the the issue of needing it to delimit multiple matches for criteria into a single cell.
------------ This version does not seem to delimit! ( at least not as far as i can read)
Function VlookupAll(rLookupVal, rTable As Range, lCol As Long) Dim rCell As Range, Result VlookupAll = CVErr(xlErrNA) For Each rCell In rTable If rCell = rLookupVal Then Result = Result & "," & rCell.Offset(, lCol - 1) End If Next rCell If Result <> "" Then Result = Right(Result, Len(Result) - 1) VlookupAll = Result End If End Function
Last edited by arthurbr; 08-11-2011 at 02:40 AM.
Hi and welcome to the board.
Please have a look at forum rules especially about adding code tags.
I will do it for you this time as it is your first post
Quoting entire posts clutters the forum and makes threads hard to read !
If you are pleased with a member's answer then use the Star icon to rate it
Click here to see forum rules
Your code is Excel code, how does that fit in with your request? I though you were working in Access. If you provide an example of your table and what you want to get from it, I can give you an example of how dlookup and dsum work. That said, if you are trying to return multiple results, you should use a query instead.
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks