So far the best solution that I've come up with on my own for this is to take the Sub Next_Date code, alter it some, place it in the Sub Userform_Initialize and made sure to delete the Sub Next_Date coding entirely so that it looks like the following –
cboOperator.SetFocus
cboMidDate.Value = Format(Date - 1, "Medium Date")
With Sheets("Midnights")
txtMidDate2.Value = Format(.Range("B" & .Rows.Count).End(xlUp).Value, "dd-mmm-yy")
End With
I added the following coding to the Sub cmdAdd_Click to try to make the end user aware –
Dim Response
Response = MsgBox("Was the Midnight Report for yesterday entered?", vbYesNo)
If Response = vbNo Then Exit Sub
And I changed a couple of lines of code in the clear userform commands to eliminate the “Invalid Property Value” error I kept getting and hopefully to “fill out” the form for a little clarity for the end user–
Me.cboMidDate.Value = Format(Date - 1, "Medium Date")
Me.cboOperator.SetFocus
BTW, just so you all know, the code in red is what was causing my error.
I still would like for a msgbox error to popup if "Todays Date" is greater than "Yesterdays Date" plus 1 day. I'd love some ideas/help on figuring that out as my current knowledge of VBA is limited to what I've been picking up and learning.
Bookmarks