Hello World,
I have a query with four (4) columns, namely:
ID, Name, Address, & RndNumber
This query is for a raffle draw, that is why i included a column Random Number using an expression of RND function..
I want a VBA code to put the ID of the highest random number to the txtbox.
I tried this code but it does not appear on the txtbox:
I have a query with four (4) columns, namely:
ID, Name, Address, & RndNumber
This query is for a raffle draw, that is why i included a column Random Number using an expression of RND function..
I want a VBA code to put the ID of the highest random number to the txtbox.
I tried this code but it does not appear on the txtbox:
Code:
Dim varHigh As Long
DoCmd.OpenQuery "qry_participants"
varHigh = DMax("RndNumber", "qry_participants")
Me.txtHighest.Value = DLookup("ID", "qry_participants", "RndNumber=" & varHigh)