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

dt picker- requiring a selction to be made 1

Status
Not open for further replies.

MagnumPI4

Technical User
Apr 20, 2009
2
US
I have created a user form that will send data to an excel file. I have several combo boxes and two dt pickers in the form. I have added code to give a message box if the user does not enter data in the combo boxes, but I can't figure out how to do the same for the dt pickers. Any ideas?

Here's what I'm using for the combo boxes:

'check for a downtime category
If Trim(Me.cboCategory.Value) = "" Then
Me.cboCategory.SetFocus
MsgBox "Please enter a Downtime Category"
Exit Sub
End If

I am brand new to VBA, so please "type slowly." Thanks.
 
Hi,

How does this code fire?

You might consider a validation procedure that you run when the user hits the control to populate the worksheet.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
You can use the same method:
Code:
If IsNull(Me.DTPicker1.Value) Then
    Me.DTPicker1.SetFocus
    MsgBox "please select date"
End If
(assumed you have a checkbox inside, otherwise DTPicker does not accept null value).

combo
 
Thanks folks! Combo- your code worked perfectly. I had been trying it with Value="" instead of IsNull. Your way made all the difference.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top