[AccessD] Some vba help please

Joe Hecht jmhecht at earthlink.net
Tue Feb 21 19:47:45 CST 2006


Charlotte

 

I am trying to make a new field. Their current key system

 

1.  Will cause duplicate values in 2010

2.  Does not allow proper numerical sort now.

 

Current system is first and last digit of year + next
sequence number

 

19-01

19-02

20-01

20-112

20-02

And so on

 

 

I want to build 

 

2000-001

2000-002

2000-003

 

Etc

 

Joe Hecht

jmhecht at earthlink.net

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Charlotte Foust
Sent: Tuesday, February 21, 2006 5:39 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Some vba help please

 

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

-- 

AccessD mailing list

AccessD at databaseadvisors.com

http://databaseadvisors.com/mailman/listinfo/accessd

Website: http://www.databaseadvisors.com




More information about the AccessD mailing list