PDA

View Full Version : [SOLVED] Send Data to Alternate Userform



Rlb53
09-16-2016, 07:07 PM
Because Office 365 Excel does not support frmCalendar, I've customized a Month Calendar on a Userform when called.
I need to call the Month Calendar Userform from Multiple Userforms.
The difficulty is identifying the Textbox where I wish the Date to be placed on the given userform that calls for the Month Calendar to Show.

I've placed a textbox on the Calendar Form that populates with the Calling Userform Name and Textbox Name, but the Month Calendar does not recognize the string.

What would be the appropriate Dim to set the Calendar form Textbox.value?



Private Sub MonthCalendar_Click()

MonthCalendar.DateDestination.Value = "Userform1.DatePicker"

MonthCalendar.Show

end sub

Private Sub SendDate_Click()

Dim a as ?
a = Me.DateDestination.Value

a.value = Me.Month.Value & "/" & Me.Day.Value & "/" & Me.Year.Value

unload me

end sub






As Always.. Assistance is Greatly Appreciated !

SamT
09-17-2016, 08:41 AM
Can you add some detail to the verbal description above?

Consider this example of Custom Object Properties.

FrmCalendar code

Dim fDate as Date

Public Property Get Date() As Date
Date = fDate
End Property

Public Property Let Date(Date As Date)
fDate = Date
End Property

Private Sub DatePicker_Click()
'Or whatever control is actually picking/setting the date to output to other forms.
fDate = 'Date picked
End Sub

To Pick a date in frmCalendar, use a code style like Sub DatePicker_Click

For a different UF to get a date from frmCalander
NewDate = frmCalendar.Date

For a different UF to assign a Date to frmCalendar

frmCalendar.Date = NewDate

Rlb53
09-17-2016, 09:13 AM
Many Thanks Sam !

A little Nudge is all I needed.

:biggrin: