473,516 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: DLookup and VBA Queries

"Keith Wilby" <he**@there.comwrote in message
news:48********@glkas0286.greenlnk.net...

Further investigation reveals that "qryItems" with the lookup field is the
culprit:

DrgNo: DLookUp("DrgNo","qryDrgApplic","ItemID=" & [tblItems].[ID] & " and
BoatID=" & [forms]![frmCertificates]![cboBoat])

If I run "qryItems" I am prompted for [forms]![frmCertificates]![cboBoat]
but if I run the query that calls the function I am not prompted.

If I change "[forms]![frmCertificates]![cboBoat]" to "1" the query calling
the function runs perfectly. Does anyone know why Access behaves this way
and if there's a workaround?

Thanks.

Keith.

Jun 27 '08 #1
1 1487
On May 15, 4:10*am, "Keith Wilby" <h...@there.comwrote:
"Keith Wilby" <h...@there.comwrote in message

news:48********@glkas0286.greenlnk.net...

Further investigation reveals that "qryItems" with the lookup field is the
culprit:

DrgNo: DLookUp("DrgNo","qryDrgApplic","ItemID=" & [tblItems].[ID] & " and
BoatID=" & [forms]![frmCertificates]![cboBoat])

If I run "qryItems" I am prompted for [forms]![frmCertificates]![cboBoat]
but if I run the query that calls the function I am not prompted.

If I change "[forms]![frmCertificates]![cboBoat]" to "1" the query calling
the function runs perfectly. *Does anyone know why Access behaves this way
and if there's a workaround?

Thanks.

Keith.
I don't know why it can't evaluate it but using querydef parms allows
you to set them

dim qdf as querydef
set qdf = currentdb.querydefs("qryItems")
qdf.parms(0) = [forms]![frmCertificates]![cboBoat]
set rs = qdf.openrecordset
Jun 27 '08 #2

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

Similar topics

6
2325
by: JLM | last post by:
What am I missing here? I have a form where I enter a "Class Code". This value corresponds to what sits in table "class code descriptions" along with the "title" of each "class code." Key field is "class code." I want a text box to be populated with the "title" which corresponds to the "class code" which I enter in the form. The...
7
1549
by: Tony Williams | last post by:
I'm trying to calculate for a report the previous year to date value of a control I'm using this: =DLookUp("","qryFDASalesV2","Year()=Year()") The report is based on a query "qryFDASalesV2" and the value I'm trying to calculate is the year to date total of "txtdomfactot" The control "txtmonthlabel" is the current month as a mmmm yyyy...
7
2245
by: Tony Williams | last post by:
Does DLookup work in an expression in a query? I have this expression -(DLookUp("","tblmaintabs","= ")) Which works fine as a calculated control on a form but when I try to use it in a query as an expression I don't get any result. I want to use the Sum of the result in a query on which I will base a report. TIA Tony
2
4131
by: ctyrrell | last post by:
I have read with interest the many discussions of the 3048 Error: Cannot open any more databases. I understand how the number of open Table ID's causes the problem. My question has to do with the usage of the Elookup routine as a substitute for Dlookup. I read that Dlookup 'does not clean up after itself'. Most of the discussion centered...
3
6574
by: BillCo | last post by:
I'm usually strongly opposed to using dlookup in queries, but I need this query to be updatable, so adding a subquery isnt an option. The dlookup works fine except, I need to sort the results based on the returned values. This doesnt work. Here's what I have (names changed to protect the innocent!): SELECT tblx.x, tblx.y, tblx.z,
2
5047
by: bobabooey2k | last post by:
I have an update query with one field having in its "Update to" cell a DLookup statement. This query takes 2-3 minutes on 3000 records. Can I avoid dlookup here using multiple queries? An underlying subquery to this Update query involves a MAX function on a date field, which is then used in the DLookup statement. Any help appreciated....
6
2477
by: Ron | last post by:
Hi All, Was just wondering which is faster, a subreport or dlookup. I've got a report with either 5 subreports or lots of dlookups. The subreports generally have anywhere from 5 to 12 controls on them so if I don't do the subreport thing, I'm doing TONS of dlookups. Just wondering what others have found to be a faster way to do things....
2
3601
by: RoadrunnerII | last post by:
Hi All I am new to this forum and still learning MS Access. Hoping this is the right place to ask If not please let me know! Looking for some help with the SQL statements in Access 2003 with the tables backended into MS SQL Server 2005 The queries work fine but cause the forms to be quite slow if I leave them as is. If I convert the Queries...
3
9044
by: Kunal Desale | last post by:
Hello, I am migrating access queries to SQL Server 2005 Queries. My Access Query Is: SELECT qtrade.intordreftrim AS Expr1, qtrade.extordreftrim AS Expr2, qtrade.intinvreftrim AS Expr3, DLookUp("",""," = " & 4 & "and ='" & & "'") AS InvNoLookup, qtrade.invline AS Expr4, qtrade.accountid AS Expr5, qtrade.descriptn AS Expr6, DLookUp("","","...
23
2752
by: dkotula | last post by:
Hello, I have a DB with linked tables to ODBC, and queries based on them. I have a form with 3 cascading combo boxes and tabs containing subforms. Along with the combo boxes on the main form I have a txtJobNum, and a txtVendorNum. The subforms I have, are Job and Vendor. In subform Job, I have txtJobNum, and in subform Vendor I have...
0
7276
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...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7581
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7548
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...
0
5714
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...
0
4773
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...
0
1624
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
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.