473,503 Members | 1,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help needed with combined Dlookup/DatePart Syntax

I am using Acc97 and trying to get the following instruction to work
in the OnOpen event of a report:

DLookup("[GiftAmt]", "tblTempRevenueByFY", DatePart("m", [GiftDate]) =
1)

The table tblTempRevenueByFY exists, with data, as do the fields
"GiftAmt" and "GiftDate". However, when I try to preview the report, I
get 2465 error that says it cannot find the field "GiftDate". I have
tried every combination of quotes, double-quotes, parentheses, etc.
that I can think of and get mostly compile errors. I have also
searched the Google groups for insight without avail.

Any and all help is greatly appreciated

TC
Nov 13 '05 #1
1 2460
The 3rd argument (the WHERE part) needs to be in quotes as well. Note that I
put single quotes around 'm' to avoid problems with quotes within quotes.

DLookup("[GiftAmt]", "tblTempRevenueByFY", "DatePart('m', [GiftDate]) =1")
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Tony Ciconte" <to******@comcast.net> wrote in message
news:0j********************************@4ax.com...
I am using Acc97 and trying to get the following instruction to work
in the OnOpen event of a report:

DLookup("[GiftAmt]", "tblTempRevenueByFY", DatePart("m", [GiftDate]) =
1)

The table tblTempRevenueByFY exists, with data, as do the fields
"GiftAmt" and "GiftDate". However, when I try to preview the report, I
get 2465 error that says it cannot find the field "GiftDate". I have
tried every combination of quotes, double-quotes, parentheses, etc.
that I can think of and get mostly compile errors. I have also
searched the Google groups for insight without avail.

Any and all help is greatly appreciated

TC

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4483
by: sdowney717 | last post by:
The field itemdate is a datetime field in sqlserver2000 DB This works fine: Select Id From BookData Where (MONTH(itemdate) = '01') and (DAY(itemdate) = '02') and (YEAR(itemdate) = '2005') order...
28
3253
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
5
1591
by: Susan Bricker | last post by:
Greetings! Can you help me? Here's the error: “Run-time error ‘2001’. You canceled the previous operation.” Here's the form description: has 2 controls involved with this error: =...
4
2480
by: basstwo | last post by:
I have a field with a serial number in it. I want to use Mid to extract the 4th and 5th characters, use them to lookup a value on a small lookup table, and use the info from that table to fill in...
6
508
by: Don Sealer | last post by:
I've written this expression for a DLookup function. It works almost alright. What I'm trying to do is type in a description and the ID field (number) populates automatically. It works almost as...
3
6272
by: Gert v O | last post by:
Can someone help me parsing this ms-access PIVOT sql-statement to a ms-sql-server sql-statement? Many thanks in advance TRANSFORM Count(KlantenStops.id) AS AantalVanid SELECT...
1
1785
by: aharding | last post by:
Hello! I am using Access 2003 I have been playing with DLookup all morning and have not been successful yet. I have never used this function...and have some limited experience with code. I...
3
1365
by: MattieG | last post by:
Hi Im trying to do a DLookup on the following. I have a form field called StartDate and i want to find a price from table where Forms!Formname!StartDate BETWEEN Start2 and End2. I just cant...
2
2425
by: Mangler | last post by:
I created a query in SQL that works fine but when i put it in the asp code ( with dreamweaver ) i am getting an error when viewing the page: expected end of statment... ...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.