Avatar of Fotofixer
Fotofixer

asked on 

Generating ranking (ordinal number) field in a query

I need to get a query to generate employee rankings in various categories so I can then add up those rankings to get a total score. I'm using Acess 2000 on Windows 2000. I've tried both solutions provided for the previous question asked like this, but I can't get either of them to work. When I try to use the long solution, I get an "undefined function" error and the VBA debugger highlights the first two lines in the module. The directions say to make sure DAO is ticked in References...there are several "Microsoft DAO *.* Object Library" listings...I've tried them all. When I try to use DAO 3.6, I get a name conflict error. Please help!
Microsoft Access

Avatar of undefined
Last Comment
nico5038
Avatar of bluelizard
bluelizard
Flag of Switzerland image

are the solutions you're mentioning part of an EE question?  if so, please post a link to that question.


--bluelizard
Avatar of nico5038
nico5038
Flag of Netherlands image

For setting the references:

Open some VBA code and select Tools/References.
Each libraryname necessary must be checked and (for you: microsoft DAO version x.xx the used version doesn't matter as long it's selected from the list).

Nic;o)
Avatar of walterecook
walterecook
Flag of United States of America image

Yes I'd like to see the code and the previous question you reference.
Nico's right in his helping to check the references.
Some other thoughts:
Are the functions ones that should be inherent (like format() for instance or are you actually referencing a custom function.
Are you trying to call myfunction() for instance, and it can't find it?
Are your functions spelled right?
Say, if you meant format() and you put fomat(), VBA will think it needs a custom function called "fomat" and it will go looking for it.

Walt
Avatar of Fotofixer
Fotofixer

ASKER

This is the question that I referenced the solutions for: I'm not sure how to set it up as a link in here.
Solution Title: Ordinal number in a query
Author: ConsultOR
Both solutions define a custom function. As far as I can tell everything is spelled correctly.
Avatar of walterecook
walterecook
Flag of United States of America image

To link, just copy and paste the URL into the message.
This looks like the one you referenced:
https://www.experts-exchange.com/questions/20589953/Ordinal-number-in-a-query.html

Maybe you could post your code so we can see ow you implemented it?

Walt
ASKER CERTIFIED SOLUTION
Avatar of nico5038
nico5038
Flag of Netherlands image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Fotofixer
Fotofixer

ASKER

That did the trick. But there is a problem with the way they wrote the expression on that site. This is the way they wrote it:

Seniority: (Select Count(*) from Employees Where [HireDate] < _
 [Emp1].[HireDate]+1;)

This is the way it should be:

Seniority: (Select Count(*) from Employees Where [HireDate] < [Emp1].[HireDate])+1

The close parenthesis goes in front of the +1

That page has a link to a file that you can download that gives many query examples.

Thanks again
Avatar of nico5038
nico5038
Flag of Netherlands image

Hmm, I would have used:
Seniority: (Select Count(*) from Employees Where [HireDate] <= [Emp1].[HireDate])

Thus the equal is automatically counted as 1 and no need for the addition :-)

Success with the application !

Nic;o)
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo