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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if DLookup is true Then

Status
Not open for further replies.

scottian

Programmer
Jul 3, 2003
955
GB
this is just a snipit of code, but basically what i want to happen is the code cycles through a list of files in a directory and imports them all into my database, but i dont want to import them if theyve already been imported. i can get it to import everything but im trying to incorporate a dlookup function to check the filename against a list of files.

If FileName <> "" Then
Do Until FileName = ""
If (DLookup("FileID", "ONJOB", "FileID" = FileName))then
'do nothing
else
DoCmd.TransferText acImportDelim, "ONJOBSpec", "ONJOB"

please help!!!

"My God! It's full of stars...
 
If dlookup doesn't find something it returns null. you could try If isNull(dlookup) then do something else do nothing
HTH
Peter
 
Something like this ?
If Not IsNull(DLookup("FileID", "ONJOB", "FileID='" & FileName & "'")) Then
DoCmd.TransferText acImportDelim, "ONJOBSpec", "ONJOB"
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top