AxxieD
AxxieD

Reputation: 614

Use DMin with Access Query

I have a table in Access 2010 that stores priority numbers for a project. There are three priority numbers. What I'm trying to do is to find the lowest number between the three columns in the Projects table, and fill it in as Overall_Priority.

Right now, I have a query, qryOverallPriority that finds the lowest value in each column.

SELECT Min(Projects.GOPri), Min(Projects.SRPri), Min(Projects.SOPri)
FROM Projects
WHERE Projects.ProjNo=Activity.ProjNo;

I'm trying to set up a DMin function to populate the Overal_Priority field but I can't figure out what to use as the first expression.

Overal_Priority = DMin("?", "[qryOveralPriority]", "Projects.ProjNo = Activity.ProjNo")

What would I use in my DMin, or is there a better way to do this?

Upvotes: 0

Views: 220

Answers (1)

chroni
chroni

Reputation: 76

just name the fields in the query something like

SELECT 
     Min(Projects.GoPri) AS MinvonGoPri
,    Min(Projects.SRPri) AS MinvonSRPri
,    Min(Projects.SoPri) AS MinvonSoPri
,    Projects.ProjectId
FROM 
     Projects
WHERE
     Projects.ProjNo=Activity.ProjNo;

Then use the DMin

OveralPrio = DMin("MinvonGoPri", "qryOveralPriority", "Projects.ProjectId=1")

Upvotes: 1

Related Questions