I have a piece of code where I am getting in a mess on the If statements, I have played around with it to such an extent I cant think straight on it -
The code is below, what it should do is this ... if the string "MissingFields" has something in it then a warning box pops up to ask the user if they want to carry on (Yes / No). If yes then it carries on.
At present if there is data in the string "MissingFields" then it works all ok, but if it is an empty string then then the code stops
' Warning box if data is missing
If MissingFields <> "" Then
If MsgBox("You are missing the following fields:" & vbCr & vbCr & MissingFields & vbCr & vbCr & "Do you wish to Continue", vbYesNo, "Warning !") = vbYes Then
' Output File
Dim OutputFile As String
OutputFile = Application.CurrentProject.Path & Me.[Fold-StartDocs] & "\Individual Starter Form - IT.pdf"
DoCmd.OutputTo acOutputReport, "Individual Starter Form - IT", "PDFFormat(*.pdf)", OutputFile, False, "", 0, acExportQualityPrint
Dim MsgContent As String
Dim StartBit4EmailMessage As String
If Nz(Me.[Start-Startdate], "") = "" Then
StartBit4EmailMessage = " who is starting with us shortly"
StartBit4EmailMessage = " who is starting with us on " & Me.[Start-Startdate]
Dim SenderName As String
MsgContent = "Hi" & vbCr & vbCr & "Please find attached a starter form for " & StartBit4EmailMessage & vbCr & vbCr & "Best Regards" & vbCr & vbCr
DoCmd.SendObject acReport, "Individual Starter Form - IT", "PDFFormat(*.pdf)", "", "", "", "Arcus New Starter - " & Me.[Gen-FullName], MsgContent, True, ""
If anyone could save me from further brain ache that would be most appreciated