Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Set DTPicker Date Value if it is not Visible on Userform

I have a DTPicker that has its Visible Property set to False at design time.
When I try to set the value in my Worksheet Double Click Event VBA throws an
error, why?
ERROR: Run-Time Error '35788'. An error occured in a cell to the Windows
Date and Time Picker control. But when I set the Visible Property to True it
works, why?

Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

' only assign a date value to DTPicker if there is a date in the cell,
' so todays date will show by default
If Not IsEmpty(Cells(Target.Row, "M")) Then
ERROR .dtpScheduledShipDate = Cells(Target.Row, "M")
End If
If Not IsEmpty(Cells(Target.Row, "N")) Then
ERROR .dtpActualShipDate = Cells(Target.Row, "N")
End If

' show userform
frmSalesSummary.Show
End Sub
--
Cheers,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Set DTPicker Date Value if it is not Visible on Userform

Try this maybe
dtpScheduledShipDate .value
dtpActualShipDate.value

"RyanH" wrote:

I have a DTPicker that has its Visible Property set to False at design time.
When I try to set the value in my Worksheet Double Click Event VBA throws an
error, why?
ERROR: Run-Time Error '35788'. An error occured in a cell to the Windows
Date and Time Picker control. But when I set the Visible Property to True it
works, why?

Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

' only assign a date value to DTPicker if there is a date in the cell,
' so todays date will show by default
If Not IsEmpty(Cells(Target.Row, "M")) Then
ERROR .dtpScheduledShipDate = Cells(Target.Row, "M")
End If
If Not IsEmpty(Cells(Target.Row, "N")) Then
ERROR .dtpActualShipDate = Cells(Target.Row, "N")
End If

' show userform
frmSalesSummary.Show
End Sub
--
Cheers,
Ryan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Set DTPicker Date Value if it is not Visible on Userform

I wish it was that easy. I can't find any help on why you can't set a
DTPickers value if its Visible Property = False.


--
Cheers,
Ryan


"Mike" wrote:

Try this maybe
dtpScheduledShipDate .value
dtpActualShipDate.value

"RyanH" wrote:

I have a DTPicker that has its Visible Property set to False at design time.
When I try to set the value in my Worksheet Double Click Event VBA throws an
error, why?
ERROR: Run-Time Error '35788'. An error occured in a cell to the Windows
Date and Time Picker control. But when I set the Visible Property to True it
works, why?

Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

' only assign a date value to DTPicker if there is a date in the cell,
' so todays date will show by default
If Not IsEmpty(Cells(Target.Row, "M")) Then
ERROR .dtpScheduledShipDate = Cells(Target.Row, "M")
End If
If Not IsEmpty(Cells(Target.Row, "N")) Then
ERROR .dtpActualShipDate = Cells(Target.Row, "N")
End If

' show userform
frmSalesSummary.Show
End Sub
--
Cheers,
Ryan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Set DTPicker Date Value if it is not Visible on Userform

Im sorry for last post maybe this would work

dtpScheduledShipDate.Visible = True
dtpScheduledShipDate = Cells(Target.Row, "M")
dtpScheduledShipDate.Visible = false


"RyanH" wrote:

I have a DTPicker that has its Visible Property set to False at design time.
When I try to set the value in my Worksheet Double Click Event VBA throws an
error, why?
ERROR: Run-Time Error '35788'. An error occured in a cell to the Windows
Date and Time Picker control. But when I set the Visible Property to True it
works, why?

Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

' only assign a date value to DTPicker if there is a date in the cell,
' so todays date will show by default
If Not IsEmpty(Cells(Target.Row, "M")) Then
ERROR .dtpScheduledShipDate = Cells(Target.Row, "M")
End If
If Not IsEmpty(Cells(Target.Row, "N")) Then
ERROR .dtpActualShipDate = Cells(Target.Row, "N")
End If

' show userform
frmSalesSummary.Show
End Sub
--
Cheers,
Ryan

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Set DTPicker Date Value if it is not Visible on Userform

Thanks for the Reply. I have a way around it. I want to know why the
Visible Property matters when setting the DTPickers value?

--
Cheers,
Ryan


"Mike" wrote:

Im sorry for last post maybe this would work

dtpScheduledShipDate.Visible = True
dtpScheduledShipDate = Cells(Target.Row, "M")
dtpScheduledShipDate.Visible = false


"RyanH" wrote:

I have a DTPicker that has its Visible Property set to False at design time.
When I try to set the value in my Worksheet Double Click Event VBA throws an
error, why?
ERROR: Run-Time Error '35788'. An error occured in a cell to the Windows
Date and Time Picker control. But when I set the Visible Property to True it
works, why?

Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

' only assign a date value to DTPicker if there is a date in the cell,
' so todays date will show by default
If Not IsEmpty(Cells(Target.Row, "M")) Then
ERROR .dtpScheduledShipDate = Cells(Target.Row, "M")
End If
If Not IsEmpty(Cells(Target.Row, "N")) Then
ERROR .dtpActualShipDate = Cells(Target.Row, "N")
End If

' show userform
frmSalesSummary.Show
End Sub
--
Cheers,
Ryan

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DTPicker Date format ranswrt Excel Programming 7 July 30th 08 06:13 AM
Date from DTPicker ranswrt Excel Programming 3 July 29th 08 09:28 PM
set date on dtpicker jocke Excel Discussion (Misc queries) 0 November 29th 05 05:02 PM
Userform always visible StephanieH Excel Programming 3 June 23rd 05 09:20 PM
How to use UserForm DTPicker.Value as Autofilter Crieteria Sulu[_2_] Excel Programming 1 August 30th 03 02:11 PM


All times are GMT +1. The time now is 03:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"