Get last record and display in an Text Box

hewstone999

Registered User.
Local time
Today, 06:48
Joined
Feb 27, 2008
Messages
37
I have a Text Box called: VNo , and a table called: DocControl.

The Table contains this information

Name............Version................Date
-------------------------------------------
GFD v0.1 09/03/2008
GFD v0.2 11/03/2008
GFD v0.3 12/03/2008
TRD v0.4 13/03/2008
GFD v0.5 14/03/2008

I want the Text Box to display the last value in the Version Column, which in this case is "v0.5"

Any help thanks?
 
in your VBA use this code.

Dim db As Database
Dim lrs As Recordset
Set db = CurrentDb()
Set lrs = db.OpenRecordset("select version from tblname")
lrs.movelast
text1.Value = lrs.Fields("version")


Hope it helps.

Ashish
 

Users who are viewing this thread

Back
Top Bottom