--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"SOS" <S...@discussions.microsoft.com> wrote in message
news:9660DA27-90DC-469D...@microsoft.com...
> In a form, I created a DLOOKUP() field. I want to find the previous
record
> ID. The form is based on a query and the number from the table below the
> query is an autonumber so there should be no differences record to record.
>
> The problem I am having is that the Dlookup is working fine, then for
> certain series of records it does not work at all.
>
> This is the expression I am using...
> =DLookUp("[URAID]","Admin Audit Query","[URAID]=" & [URAID]-1)
>
> Can anyone help?
>
> Thanks!
>
Thanks!
If your form is sorted on URAID then I guess you could do a
RecordsetClone.MovePrevious in code and grab the URAID of that record.
--
George Nicholson
Remove 'Junk' from return address.
Sorry for the confussion...Is there an even better way to do this perhaps?
Thanks
What you can use instead is
=DMax("[URAID]","Admin Audit Query","[URAID] < " & [URAID])
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"SOS" <S...@discussions.microsoft.com> wrote in message
news:1BEF4F6F-B42A-4AA0...@microsoft.com...
Douglas & I are saying the same thing, but his solution is better. :-)
=DMax("[URAID]","Admin Audit Query","[URAID] < " & [URAID])
Translation: "What is the largest value of URAID that is less than x?"
(Where x = the current URAID)
It avoids the "one less than" issue very nicely.
HTH,
--
George Nicholson
Remove 'Junk' from return address.
"SOS" <S...@discussions.microsoft.com> wrote in message
news:9A003637-2D11-4BDC...@microsoft.com...