DLookup Expression

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

DLookup Expression

Post by burrina »

I need to get the last check number from this table
table = TCheckNo
field = CCheckNo

I know this is wrong but what am I missing? Like DLookup

Code: Select all

Me.txtLicNo = DLast([CCheckNo],[TCheckNo],[CCheckNo])

User avatar
HansV
Administrator
Posts: 78393
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: DLookup Expression

Post by HansV »

The result of DLast is unpredictable. Moreover, the arguments of all functions such as DLookup must be strings.

If CCheckNo always increases, you can use

Me.txtLicNo = DMax("CCheckNo","TCheckNo")
Best wishes,
Hans

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Re: DLookup Expression

Post by burrina »

Yes it is autoincremented.
Thank You Hans