[AccessD] A2K: Same Name Validation

Stephen Bond stephen at bondsoftware.co.nz
Thu Sep 9 03:39:24 CDT 2004


Darren,

I do this in one of my apps: 

Function DuplicateCount(fnIn, snIn) As Long
Dim k As Variant, criteria as String
  criteria = "FirstName = '" & fnIn & "' AND LastName = '" & snIn & "'"
  k = Nz(DCount("*", "tblWhatever", criteria))
  DuplicateCount = k
End Function

I cop the overhead of another index on the table.  It's a multi-field index, it contains the FN field and the LN field, call it CombinedName, duplicates allowed. I think this is supposed to make it faster.  If it doesn't it makes me feel better anyway <g>

Stephen Bond
Otatara, New Zealand



> -----Original Message-----
> From: Darren DICK [mailto:d.dick at uws.edu.au]
> Sent: Thursday, 9 September 2004 5:14 p.m.
> To: 'Access Developers discussion and problem solving'
> Subject: RE: [AccessD] A2K: Same Name Validation
> 
> 
> Hi Francisco
> Pretty Basic
> tblStudents
> LastName (TEXT)
> FirstName (TEXT)
> 
> That's all I want to test. Just if there is one John SMITH and 
> a data entry person is entering a second one, I wanna alert them.
> 
> I was thinking of a combined dlookup with First and Last name and if
> the count was greater than zero, alert the user
> 
> Many thanks
> 
> Have a great day
> 
> Darren
> 
> 
> 
>
> 



More information about the AccessD mailing list