PDA

View Full Version : Solved: Check if exists



Marcster
06-26-2012, 02:40 AM
I have a string variable: strFilename
And a query: qryImportedFilenamesList which only returns one field, FileName
What I am trying to do is, if strFilename exists in qryImportedFilenamesList then msgbox "Already exists."
else
msgbox "Does not exist."

strFilename is a file name of a potential import file, I'm checking to see if it has already been imported.

Thanks,

Marcster
06-26-2012, 05:10 AM
I done it.

If IsNull(DLookup("[Filename]", "qryImportedFilenamesList", "[Filename] = '" & strfile & "'")) Then
msgbox "Does not exist."
else
msgbox "Already exists."
End if