I have a userform with 2 tabs - on the 2nd tab there are two fields that contain dates (using the Windows Date and Time Picker Control). I get this error when the first tab is selected and my userform updates with the data in my spreadsheet. It works just fine if the second tab is the tab on top. The complete error is:
Run-time error '35788' An error occured in a call to the Windows Date and Time Picker control
Here is the code I'm using
Run-time error '35788' An error occured in a call to the Windows Date and Time Picker control
Here is the code I'm using
Code:
Private Sub Search_Click()
Dim r As Long
Dim ws As Worksheet
Set ws = Worksheets("Database")
LastRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0, 0).Row
If IsNumeric(RowNumber.Text) Then
r = CLng(RowNumber.Text)
Else
MsgBox "You must enter a number"
Exit Sub
End If
If r > 1 And r <= LastRow Then
txtHTName.Value = ws.Cells(r, 1)
DTPicker1.Value = ws.Cells(r, 2)
txtName.Value = ws.Cells(r, 3)
txtTitle.Value = ws.Cells(r, 4)
txtPhone.Value = ws.Cells(r, 5)
txtFax.Value = ws.Cells(r, 6)
txtEmail.Value = ws.Cells(r, 7)
txtCompanyName.Value = ws.Cells(r, 8)
txtParent.Value = ws.Cells(r, 9)
txtAddress.Value = ws.Cells(r, 10)
txtCity.Value = ws.Cells(r, 11)
txtState.Value = ws.Cells(r, 12)
txtWeb.Value = ws.Cells(r, 13)
txtIndustry.Value = ws.Cells(r, 14)
txtRev.Value = ws.Cells(r, 15)
txtEmployee.Value = ws.Cells(r, 16)
txtSource.Value = ws.Cells(r, 17)
txtSourceName.Value = ws.Cells(r, 18)
txtRecentActivity.Value = ws.Cells(r, 19)
DTPicker2.Value = ws.Cells(r, 20)
txtNextActivity.Value = ws.Cells(r, 21)
DTPicker3.Value = ws.Cells(r, 22)
txtTarget.Value = ws.Cells(r, 23)
txtTargetFee.Value = ws.Cells(r, 24)
txtTarget2.Value = ws.Cells(r, 25)
txtTargetFee2.Value = ws.Cells(r, 26)
txtProvider.Value = ws.Cells(r, 27)
txtProb.Value = ws.Cells(r, 28)
txtGeneral.Value = ws.Cells(r, 29)
ElseIf r = 1 Then
MsgBox "No record available; please enter another number"
Else
MsgBox "No record available; please enter another number"
End If
End Sub