Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-06-2019, 03:45 AM   #1
Wysy
Newly Registered User
 
Join Date: Jul 2015
Posts: 163
Thanks: 2
Thanked 2 Times in 2 Posts
Wysy is on a distinguished road
DLookup/Dmax function error after append query

Hi,
I have the following problem that emerged in my database.
I have a table with alphanumeric id. I need to know the last one when i enter new data using an entry form. So on the entry form i have an unbound control with Dlookup/Dmax function. The function runs on a query based on the given table. Everything worked fine until i have ran an append query than added records to this table. The combined Dlookup/Dmax function results in an error.
So i copied the table, deleted all records and with copy/paste i entered all data again. Function works now. I suppose something with the primary key happened that has an autonumber field.
The combined Dlookup/Dmax function looks up a value from the query where a serial number has its max:
=DLookUp("[HUN_ID]","qrLastIMfrmCSBJ","Year=2019 And Serial=" & DMax("Serial","qrLastIMfrmCSBJ","Year='2019'"))

So my very question is why this happens? The append query did not have any autonumbered field just data for the first two columns of the table.
If the problem is caused by the autonumber field how can i restore the primary key?
thank you
regards
Andrew

Wysy is offline   Reply With Quote
Old 09-06-2019, 03:50 AM   #2
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,569
Thanks: 68
Thanked 2,745 Times in 2,630 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: DLookup/Dmax function error after append query

you have Year=number and the last, Year=string.
which one is correct?
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] DMax Function in Query Works But Not As I Want dlhappy Queries 5 01-22-2014 10:57 PM
Type mismatch error on DMax function using dates Pis7ftw Modules & VBA 2 10-18-2013 07:48 PM
Using DMax Function in a query KristenD Queries 15 08-14-2012 10:27 AM
append - dlookup or dmax problem jeffr27 Queries 1 05-10-2011 03:06 AM
Dmax or Dlookup in query dheich4321 Queries 3 04-23-2004 07:42 AM




All times are GMT -8. The time now is 04:20 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World