Set db = CurrentDb
strSQL = "Select * from tmp_SODetail;"
Set rst = db.OpenRecordset(strSQL)
rstRecCount = rst.RecordCount
CurrentCount = DCount("*", "tmp_SODetail")
If CurrentCount = 1 Then
' There were no records
rstValue = 1
Else
' records exist
rst.MoveLast
rstValue = rst.RecordCount
End If
Me!SOLine.Value = Format(rstValue, "000")
|