ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RUN-TIME ERROR 438 (https://www.excelbanter.com/excel-programming/390397-run-time-error-438-a.html)

mmmbl

RUN-TIME ERROR 438
 
I have the user pick up a date from the calendar and returns that value to
the txt1stDistStart.
I wanted to validate that the date selected is less or equal to the
Effective Date (txtEffdate) if not I wanted to return to the Distribution
Field (txt1stDistStart) but I keep getting run-time erro 438 - Object doesn't
support this property or method. Where did I go wrong?

Private Sub txt1stDistStart_Change()
If Me.txt1stDistStart Me.txtEffDate Then
MsgBox "1st Distribution Is Greater Than Start Date"
Sheets("Promo Request Form").Activate
Me.txt1stDistEnd.ActiveControl
Me.txt1stDistStart.SetFocus

Else
Me.txt1stDistEnd.SetFocus

End If
End Sub

Thank You

Mike

RUN-TIME ERROR 438
 
look at this see if it something you can change for your needs
If DTPStartDate.Value DTPEndDate.Value Then
MsgBox "Start Date Can not be greater then End Date", vbCritical,
Exit Sub 'get out
End If
' your code here if DTPStartDate.Value is less than
'DTPEndDate.Value
you should be able to add .value to txt1stDistStart.value

"mmmbl" wrote:

I have the user pick up a date from the calendar and returns that value to
the txt1stDistStart.
I wanted to validate that the date selected is less or equal to the
Effective Date (txtEffdate) if not I wanted to return to the Distribution
Field (txt1stDistStart) but I keep getting run-time erro 438 - Object doesn't
support this property or method. Where did I go wrong?

Private Sub txt1stDistStart_Change()
If Me.txt1stDistStart Me.txtEffDate Then
MsgBox "1st Distribution Is Greater Than Start Date"
Sheets("Promo Request Form").Activate
Me.txt1stDistEnd.ActiveControl
Me.txt1stDistStart.SetFocus

Else
Me.txt1stDistEnd.SetFocus

End If
End Sub

Thank You


mmmbl

RUN-TIME ERROR 438
 
I did something different from your proposal but this one also worked. I have
to make the calendar pop-up again so the user can choose another date.
Thanks for the reply.

"Mike" wrote:

look at this see if it something you can change for your needs
If DTPStartDate.Value DTPEndDate.Value Then
MsgBox "Start Date Can not be greater then End Date", vbCritical,
Exit Sub 'get out
End If
' your code here if DTPStartDate.Value is less than
'DTPEndDate.Value
you should be able to add .value to txt1stDistStart.value

"mmmbl" wrote:

I have the user pick up a date from the calendar and returns that value to
the txt1stDistStart.
I wanted to validate that the date selected is less or equal to the
Effective Date (txtEffdate) if not I wanted to return to the Distribution
Field (txt1stDistStart) but I keep getting run-time erro 438 - Object doesn't
support this property or method. Where did I go wrong?

Private Sub txt1stDistStart_Change()
If Me.txt1stDistStart Me.txtEffDate Then
MsgBox "1st Distribution Is Greater Than Start Date"
Sheets("Promo Request Form").Activate
Me.txt1stDistEnd.ActiveControl
Me.txt1stDistStart.SetFocus

Else
Me.txt1stDistEnd.SetFocus

End If
End Sub

Thank You



All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com