Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query most recent record

Status
Not open for further replies.

jabenj

Technical User
Joined
Dec 18, 2008
Messages
20
Location
US
Hi. Any help would be greatly appreciated. I'm trying to query my database for the most recent record for a tank specified by the user on a form. I have an If then statement based on that query as shown below:

If DCount("LotNum", "[Blendsheet Input]", "TankNum ='" & Me.cmbTankNum & "'") = 0 Then
Me.TxtStatus = "Not Finalled"

Else
Me.TxtStatus = "Finalled"

End If

Exit_Close_Click:
Exit Sub

End Sub


This partially works. When I add a new record that should return a "Not Finalled," The query returns a "Finalled." The code doesn't seem to be reading most recent entry. Can someone let me know what i'm doing wrong?

Thanks
 
are you sure you've posted the new record to the table before trying to run this code? If you haven't posted the record then DCOUNT will return a 0 and you'll get 'Not Finalled' which is what you should get if it's a zero.




Leslie

Have you met Hardy Heron?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top