473,748 Members | 7,827 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]", "tblTempRevenue ByFY", DatePart("m", [GiftDate]) =
1)

The table tblTempRevenueB yFY 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 2472
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]", "tblTempRevenue ByFY", "DatePart(' m', [GiftDate]) =1")
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

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

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

The table tblTempRevenueB yFY 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
4500
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 by TitleDuplicate This does not work: Select Id From BookData Where (MONTH(itemdate) = '01') and (DAY(itemdate) = '02') and (YEAR(itemdate) = '2005') and (datepart(Hh,
28
3303
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 make-believe challenge in order to avoid confusing the issue further. Suppose I was hosting a dinner and I wanted to invite exactly 12 guests from my neighborhood. I'm really picky about that... I have 12 chairs besides my own, and I want them all...
5
1604
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: = unbound text box (expecting user to type in dog registration number (format: yy-nnnn) = unbound combobox with three columns: 1=dogID (key to tblDogs
4
2504
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 the value for my lens field. I tried doing this: =DLookUp(!,,Mid(!,4,2)=!) Where LensLookup is my lookup table, LensName is the value I want to have appear
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 I've said. It doesn't populate until I go to a new record. Then if I go back to the record the number is in the field. Instead of populating immediately it waits until I've created a new record. Am I making sense with this description. Here's...
3
6292
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 KlantenStops.Uitvoerder, KlantenStops.Klant FROM KlantenStops GROUP BY KlantenStops.Uitvoerder, KlantenStops.Klant PIVOT DatePart("m",leverdatum,1,0) In ("1","2","3","4","5","6","7","8","9","10","11","12");
1
1804
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 will post what I have tried so far and hopefully someone can help me problem solve. I have tried three different methods... (I know Calculation is spelled wrong..I have to go through my database and fix it everywhere just haven't had the time...
3
1383
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 get the syntax correct at all, theres too many "" all over the place. Its the criteria field that i just cant manage to string together. Ive
2
2435
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... rsBERProd_cmd.CommandText = "SELECT ISNULL(sum(case when type = 'BD' and _dte = Convert(Char(8),GETDATE(),112) then qty else 0 end),0) as Dayqty,ISNULL(sum(case when type = 'BD' and _dte between dateadd(dd,- (day(GetDate())-1),GetDate()) and ...
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9534
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9316
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3303
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 we have to send another system
2
2777
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.