Access 2003 DLookup Query Error 3072

J

Joe Giaquinto

This is a strange one...

I have just installed Office 2003 on my Win2k Pro machine.
Very clean install. Brand new machine. No other Office
products left over from previous installs.

I can't get DLookup to work at all in Access 2003 queries.
I'm trying to use DLookup in a query to look up a starting
and ending date from a table.

I use DLookup extensively. This is not a syntax error
issue. The same query works fine in Access 2000.

I tried re-referencing components in Tools->References. I
tried creating a blank database. I tried pasting code
samples from the help articles.

DLookup just does not work for any data or any format in
either criteria or the field box.

I tried DLookup in a module. It worked fine.

The help says it should work. Any thoughts would be
appreciated. I searched extensively on this and only found
one Google link from a tech forum where maybe a dozen
people were getting the same problem and no one had a
solution.

Thanks in advance. For now I can write a VBA DLookup
function and call it but I will have to rewrite lots of
databases to support my clients who are moving up to 2003.

Joe Giaquinto
 
A

Allen Browne

Joe, are you able to pinpoint the circumstances under which this fails?

For example, are you using DLookup() against:
- Access tables in the same database?
- Attached (linked) Access tables?
- ODBC or Sql Server tables?

Is the problem query the RecordSource for a form/report?
Or is it used in coce via OpenRecordset or Execute?

Have you turned off Name AutoCorrect (Tools | Options | General)?

What results are you seeing? #Error? Null (i.e. no match)?

Post an example of a query that fails (i.e. switch the query to SQL View and
copy the statement).

There is a replacement for DLookup() in this link, but it would probably be
more useful for you to get the original working:
http://allenbrowne.com/ser-42.html
 
D

david epsom dot com dot au

I see that I got error 3072 when the call, and the table,
was in CodeDB (in a referenced database): DLookup is a
method of CurrentDb, and does lookup only in CurrentDB.

? Does your value of CurrentDB match your value
of DbEngine(0)(0) ?

(david)
 
Top