Solved

DMin refresher

Posted on 2013-01-31
6
286 Views
Last Modified: 2013-01-31
I am trying to look up the oldest order a member made to update the member table but need a refresher.

Here's what I have:
t: DMin("DeliveryDate","tblTranslationContractHistory","[tblTranslationContractHistory]![ContactID] = [tblTranslationContractMembers]![ContactID] ")

The sql error is can't find the name tblTranslationContractMembers.ContactID

Any ideas to fix my a lib syntax?
0
Comment
Question by:Shawn
  • 3
  • 2
6 Comments
 
LVL 26

Expert Comment

by:jerryb30
ID: 38841575
Can you give the full context of the query?
0
 
LVL 26

Assisted Solution

by:jerryb30
jerryb30 earned 200 total points
ID: 38841592
winging it:

select [contactID],  DMin("DeliveryDate","tblTranslationContractHistory","[tblTranslationContractHistory]![ContactID] = ' " & a.[contactID] & "'") as t from [tblTranslationContractMembers] as a
0
 
LVL 1

Author Comment

by:Shawn
ID: 38841914
note quite.

Here is a query which works but it is a groupby query qhich doesn't work to update. I need the equivalent with dmin.

SELECT tblTranslationContractMembers.DateStart, tblTranslationContractMembers.ContactID, Min(tblTranslationContractHistory.DeliveryDate) AS MinOfDeliveryDate
FROM tblTranslationContractHistory INNER JOIN tblTranslationContractMembers ON tblTranslationContractHistory.ContactID = tblTranslationContractMembers.ContactID
GROUP BY tblTranslationContractMembers.DateStart, tblTranslationContractMembers.ContactID;
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 26

Expert Comment

by:jerryb30
ID: 38841922
Just to save me some time, can you post a sample db with some dummy data?
And, maybe what you are trying to update.
0
 
LVL 11

Accepted Solution

by:
datAdrenaline earned 300 total points
ID: 38842401
Give this a whirl ...

SELECT tblTranslationContractMembers.DateStart
      , tblTranslationContractMembers.ContactID
      , vtblFirstDeliveries.FirstDelivery
FROM tblTranslationContractMembers
     LEFT JOIN
       (SELECT ContactId, Min(DeliveryDate) As FirstDelivery
        FROM tblTranslationContractHistory
        GROUP BY ContactId) As vtblFirstDeliveries 
     ON tblTranslationContractMembers.ContactId = vtblFirstDeliveries.ContactId

Open in new window

0
 
LVL 1

Author Comment

by:Shawn
ID: 38842528
wow  datAdrenaline, you knocked it out of the park. Nice.

I also got this to work but I like your query.

DMin("DeliveryDate";"tblTranslationContractHistory";"ContactID=" & [contactID])
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
File.Search issue 8 32
Dot leaders between two labels in report 10 33
Record with #Error 8 33
Error can't find table ?? 5 24
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question