I'm trying to write an sql statement for an on_click event in a form that would check a table to find the record with the most recent record date, and assign certain field values from the record to variables so I can reference the variables in a comparison. I'm trying to make it a quick and efficient process, so have avoided dlookups. Am I even on the right track? I can't figure out how to assign the results from statement below to variables. Any ideas would help. Thanks
SELECT tblHist.FileDt AS LastFileDt, tblHist.FileName AS LastFileName FROM tblHist WHERE (((tblHist.FileName)=(Select [fileName] from tblHist where [FileDt] = (Select max([filedt]) from tblHist))));"
SELECT tblHist.FileDt AS LastFileDt, tblHist.FileName AS LastFileName FROM tblHist WHERE (((tblHist.FileName)=(Select [fileName] from tblHist where [FileDt] = (Select max([filedt]) from tblHist))));"