473,781 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dlookup issues with Query converted to Passthrough Query

3 New Member
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 into Passthrough queries as suggested by a DBA I cannot get the Dlookup below to work
The error I get is ODBC Call Failed ... 'DLookUp' is not a recognized built in function name (#195)
Is there another way to do this simply?
If I plug in one of the values available to the dlookup intop the query after the "=" it works fine and the form refreshes quickly

Thanks
RRII


SELECT [Serialized Inventory].[Inventory Status], [Serialized Inventory].[Usage Status], [Serialized Inventory].[Inventory Type], [Serialized Inventory].Manufacturer, [Serialized Inventory].[Model Name], Count([Serialized Inventory].[Model Name]) AS [CountOfModel Name], [Serialized Inventory].[End of Life], [Serialized Inventory].[Group]
FROM [Serialized Inventory]
GROUP BY [Serialized Inventory].[Inventory Status], [Serialized Inventory].[Usage Status], [Serialized Inventory].[Inventory Type], [Serialized Inventory].[Manufacturer], [Serialized Inventory].[Model Name], [Serialized Inventory].[End of Life], [Serialized Inventory].[Group]
HAVING ((([Serialized Inventory].[Inventory Status])='undetermined ' Or ([Serialized Inventory].[Inventory Status])='current inventory' Or ([Serialized Inventory].[Inventory Status])='In-Storage Inventory') AND (([Serialized Inventory].[End of Life])='0') AND (([Serialized Inventory].[Group])=DLookUp('[defswitchboard]','tblDefaults' )));
Jan 31 '08 #1
2 3637
Jim Doherty
897 Recognized Expert Contributor
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 into Passthrough queries as suggested by a DBA I cannot get the Dlookup below to work
The error I get is ODBC Call Failed ... 'DLookUp' is not a recognized built in function name (#195)
Is there another way to do this simply?
If I plug in one of the values available to the dlookup intop the query after the "=" it works fine and the form refreshes quickly

Thanks
RRII


SELECT [Serialized Inventory].[Inventory Status], [Serialized Inventory].[Usage Status], [Serialized Inventory].[Inventory Type], [Serialized Inventory].Manufacturer, [Serialized Inventory].[Model Name], Count([Serialized Inventory].[Model Name]) AS [CountOfModel Name], [Serialized Inventory].[End of Life], [Serialized Inventory].[Group]
FROM [Serialized Inventory]
GROUP BY [Serialized Inventory].[Inventory Status], [Serialized Inventory].[Usage Status], [Serialized Inventory].[Inventory Type], [Serialized Inventory].[Manufacturer], [Serialized Inventory].[Model Name], [Serialized Inventory].[End of Life], [Serialized Inventory].[Group]
HAVING ((([Serialized Inventory].[Inventory Status])='undetermined ' Or ([Serialized Inventory].[Inventory Status])='current inventory' Or ([Serialized Inventory].[Inventory Status])='In-Storage Inventory') AND (([Serialized Inventory].[End of Life])='0') AND (([Serialized Inventory].[Group])=DLookUp('[defswitchboard]','tblDefaults' )));

Taking up on the fact that you are learning Access and thus new my reply might be enough perhaps to send one to sleep but bear with me LOL

'Dlookup' is indeed not a function in SQL Server. I am afraid. You are working on the server side here so SQL servers transact sql language is being used.

In answer to your question I see your dlookup function in access is evidently only seeking it seems to return a single value against 'SerialisedInve ntory.Group' so using a

"SELECT defswitchboard FROM dbo.tbldefaults " in your criteria clause for that 'specific' column would suffice once your syntax is converted.

You will have to rethink not only the syntax but also your SQL syntax generally. If as you say you are learning might I give a few pointers? Can I suggest you change your field and table naming convention? Drop the spaces in field names and table names!. This makes life easier because you will not have to wrap them in square brackets and thus you will have more chars available to you to use in any subsequent SQL on the server side.

Google a search on lechinsky/Roddick naming convention for object naming convention a good standard for Access and not bad taboot for SQL server either

In addition given you are learning and in the process of converting take time to have a look at placing your converted syntax into 'stored procedures' and pass any criteria clauses you have as parameters to the procedure. You can call stored procedure in Access using pass through queries with less syntax and the return will be faster as stored procdures are pre-compiled.

You can use pass dynamic SQL of course but stored procedures should be your ultimate goal.

Converting an Access database generally to satisfy SQL server is not without pain I'm afraid and in so converting you might want to consider some options regarding the interface on the Access side once your table data and SQL is converted.

What are you using mdb files or the ADP format? If you are not aware of the ADP format then have a look at it, because it exposes the 'Views' and stored procedures held on the server 'but' in the Access interface itself and is a good format for interacting with SQL server data.

ADP forms have inbuilt properties to accept input parameters pass them to the server and return data to the 'Access form' that standard mdb files do not have amongst other properties like 'Resynch' and Serverfilter and other properties designed specifically for SQL server.

The ADP format was built by MS specifically to interact with SQL server using universal datalink as opposed to ODBC. You may or may not find them of use to you depends on the complexities and nature of your conversion process. If local tables are required on the Access side then ADP files are not for you.

The preference on MDB or ADP is a personal one with office 2007 seemingly now preferring mdb format

Hope this whilst a little verbose gives you an insight

Regards

Jim :)
Feb 1 '08 #2
RoadrunnerII
3 New Member
Thanks for quick reply Jim
I will investigate the suggestions and see what will work
Feb 1 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
7278
by: Paradigm | last post by:
I want to create a pass through query in Access to get data from a MYSQL table. I need to do this using code so that sertain aspects of the query can be changed. When I look at the SQL version of a Select and a Passthrough query in access they appear to be the same. eg. "SELECT * FROM MYTABLE WHERE MYFILED = TRUE" What do I need to do to make this a pass through query? Any help appreciated. Alex
3
3178
by: Tripp Knightly | last post by:
I have a lookup table from which I want to categorize various bands of customer net income. Some of the income is positive, some is negative. The bands vary in size (ie, <500, -200 to 0, 100 to 1000). When I have a lookup table w/ the "threshold" amounts of income, I'm not able to get dlookup to work, and I'm pretty sure it's getting tripped up by negative / positive lookup values. Is it not possible to do lookups on a table w/ both...
3
2502
by: DFS | last post by:
FYI, Using DLookup("ResultsField","Pass-thru query") consumes 2 SEQUENCE numbers each time it's called. Anyone know why?
6
1773
by: John Welch | last post by:
I have a potential client who wants an application with about 20,000 records and 5-8 users. I told him that Access would work fine, but he wants to go with an mdb front end linked to SQL Server tables. My experience is solely in Access (single user) and I'm trying to decide whether to take the job or pass. I assume I'd just create the tables in Access and then upsize them with the wizard to get started. After that I don't how much the...
8
4320
by: Christine Henderson | last post by:
I have a problem using the above function in the following simplified circumstance: In the lookup table called "Klms Travelled" I have 3 fields, eg: Receiver Name Receiver Suburb Klms Distance Jones Melbourne 500 Harrison Sydney 200 Ford Brisbane 700 Jones ...
3
2931
by: ECUweb | last post by:
Hi, I've got this instruction in a column of a query: DLookUp("","qryPuntospORPescador","APELLIDO='" & & "' AND NOMBREPESCADOR ='" & & "'") I need to sort out the records of the column in "numerical" ascending order. However, the results of the DLookUp function are converted into text. The records in the field "SumaDePUNTOS" in the query "qryPuntosPorPescador" are "numbers" and I need the DLookUp function to return "numbers" Is...
3
9121
by: RAG2007 | last post by:
I'm using the QueryDef and Execute method to update a record in my MySQL backend. Problem: When the Passthrough update query is defined using QueryDef, it becomes a select query, and I cannot use the Execute Method. Instance: The following code is defined as a query called "AddCost" UPDATE tblinitiative SET tblinitiative.Estimate = " & Estimate & ", tblinitiative.FinalCost = " & FinalCost & " WHERE (((tblinitiative.InitID)=" & InitID &...
6
4406
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one field between them. The join field in both tables are indexed and I'm selecting 1 field from each table to lookup. The Access query is taking more than 60 second to retrieve 1 record and if I execute the same query within the Query Analyzer, it...
3
9071
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("",""," = " & 0 & "and ='" & & "'") AS , qtrade.qtyinv AS Expr7, qtrade.invdate AS Expr8, qtrade.amtuchg...
0
10306
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...
0
10139
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10075
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
9931
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
8961
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
6727
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
5373
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...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
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

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.