hello, i am using the following code to get the status of a file in diferents folder, but i dont how figure out how load the vba code to load auto for all records. I was testing in command click event and work, but where put this to load without user intervention. I was trying in Form load, also in Form current , but nothing... and the end what I need is the system check in my folder if the file exist or not, an show a text document exist or doc missing
this is the code I am using:
Dim filename As String
Dim filepath As String
Dim cname As String
Dim missinvalue As String
Dim docexist As String
docexist = "Doc. Exist"
missinvalue = "Doc. Missing"
cname = Forms![ContractorsDBForm]![Text442]
filename = Me.DocumentsName & ".pdf"
filepath = DLookup("[ContractorPath]", "querysetup") & cname & DLookup("[expr1]", "querysetup") & cname & " " & filename
If Dir(filepath) = "" Then
Me.MissDoc = missinvalue
Else
Me.MissDoc = docexist
End If
thanks in advance