If statement

Jpernice

New member
Local time
Today, 05:12
Joined
Mar 21, 2011
Messages
8
Helo

Quick question like to know if if this possible
I put together this little bit of code. This count all the filed in folder then sent a email,
Would like to know if there a way to sent out a different message depend on if the is any file.

It not work any though possible


Dim file1 As Object
Dim filecount1 As Long

With CreateObject("Scripting.FileSystemObject").GetFolder("P:\")

For Each file In .Files

If file.Name Like "*" Then

filecount1 = filecount + 1
End If

If filecount1 = 0 Then
Strbodytext2 = "Option 2"
Strbodytext1 = "Option 1"
DoCmd.SendObject , "", "", "", "", "Jonathan Pernice", "Test", Strbodytext1, False, ""
Else
DoCmd.SendObject , "", "", "", "", "Jonathan Pernice", "Test", Strbodytext2, False, ""
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom