Charlotte Foust
cfoust at infostatsystems.com
Tue Feb 21 19:38:32 CST 2006
It looks to me like you're trying to use the same NewAccidentID for all the records. Surely that isn't what you wanted is it? Charlotte -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Hecht Sent: Tuesday, February 21, 2006 5:12 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Some vba help please Private Sub Accident_Date_AfterUpdate() Me.txtNewAccidentID = Right(txtAccidentDate, 4) & " - " & DMax(NewAccidentID, [20_tblAccidentmaster]) End Sub I am trying to build a new key for each record in a table. Right(txtAccidentDate, 4) gets the year. " & right(DMax(NewAccidentID, [20_tblAccidentmaster]),3)+1 gets the next sequential number. 1. The code is not firing. I am getting no error or value. 2. Does this code look correct to my purpose. Joe Hecht jmhecht at earthlink.net -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com