473,396 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dlookup issues with Query converted to Passthrough Query

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 3585
Jim Doherty
897 Expert 512MB
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 'SerialisedInventory.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
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
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...
3
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...
3
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
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...
8
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 ...
3
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...
3
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...
6
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...
3
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,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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
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...

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.