PC Review


Reply
Thread Tools Rate Thread

dlookup using a date defiined by another dlookup

 
 
=?Utf-8?B?QmVubnlESGlsbA==?=
Guest
Posts: n/a
 
      8th Aug 2007
Hi, i am trying to check whether a date that exists in one table, already
exists in another before adding data to that table. i cannot use referential
integrity due to the way the data is set out. i am getting the date for the
first dlookup, but the second one is returning the wrong date or error
messages. i have tried different criteria such as [payment date] =
FECVCollected, [Payment Date], "FECCollected" etc. any ideas?

regards, Ben

Dim FECCollected As Date
Dim FECValue As Variant

FECCollected = DLookup("[Payment Date]", "tbl_Exchange_Rate_Data_Collected",
"[Lookup] ='1'")

FECValue = DLookup("[Payment Date]", "tbl_Exchange_Rate_Data", "[Payment
Date] = ""FECCollected")
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3RldmVN?=
Guest
Posts: n/a
 
      8th Aug 2007
Try this:

Dim FECCollected As Date
Dim FECValue As Date

FECCollected = DLookup("[Payment Date]", "tbl_Exchange_Rate_Data_Collected",
"[Lookup] = " & 1)

FECValue = DLookup("[Payment Date]", "tbl_Exchange_Rate_Data", "[Payment
Date] = #" & FECCollected & "#")

Numeric values do not need quotes.
Text values must have single quotes.
Date values require octothorpes.

Steve

"BennyDHill" wrote:

> Hi, i am trying to check whether a date that exists in one table, already
> exists in another before adding data to that table. i cannot use referential
> integrity due to the way the data is set out. i am getting the date for the
> first dlookup, but the second one is returning the wrong date or error
> messages. i have tried different criteria such as [payment date] =
> FECVCollected, [Payment Date], "FECCollected" etc. any ideas?
>
> regards, Ben
>
> Dim FECCollected As Date
> Dim FECValue As Variant
>
> FECCollected = DLookup("[Payment Date]", "tbl_Exchange_Rate_Data_Collected",
> "[Lookup] ='1'")
>
> FECValue = DLookup("[Payment Date]", "tbl_Exchange_Rate_Data", "[Payment
> Date] = ""FECCollected")

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DLookup with a Date scarlton via AccessMonster.com Microsoft Access Forms 5 11th Feb 2007 02:08 AM
Re: Dlookup function - copying the dlookup info into a field.... Douglas J. Steele Microsoft Access Forms 0 6th Dec 2006 02:05 PM
Dlookup with Last Date =?Utf-8?B?V2FoYWI=?= Microsoft Access Form Coding 1 15th Aug 2006 10:47 AM
DLookup - with Date =?Utf-8?B?QW5keQ==?= Microsoft Access VBA Modules 2 23rd Aug 2004 01:56 PM
Dlookup problems (was my Dlookup hell) Kavvy Microsoft Access Form Coding 3 18th Nov 2003 12:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:44 PM.