If you're looking for a specific value based on criteria you could also use this...
dim MyDB as database
dim MyRecs as recordset
dim MySQL as string
MySQL = "SELECT [FieldName] FROM [QueryName] Where [FieldCriteria]='" & txtCriteria & "'"
set MyDB = currentdb
set MyRecs = MyDB.openrecordset(MySQL)
YourVariable = MyRecs!FieldName
MyDB.close
set MyRecs = nothing
set MyDB = nothing
'Note that I used the tic marks(') in the SQL statement. This is if your criteria is a string. If your criteria is a number, then just omit the tick marks('). Hope this helps.