Question : When ActiveX control on form changes, apply new value to another control on form.

I have a “Calendar” ActiveX Control on a form named 'frmMain'.  If gives me for possible events:
1) On Updated
2) On Enter
3) On Exit
4) On Got Focus
5) On Lost Focus

I have another form control named 'txtDate' whose default value is DateRange90("Start"), which is based on the function
listed below which is based on my calendar ActiveX Control.

When the form loads, the 'txtDate' is populated with the value of DateRange90("Start").  However, when the user changes to the calendar date via the ActiveX Control, I want the new date to be reflected in 'txtDate'.  Any ideas on how I can make this work?

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
Public Function DateRange90(StartEnd) As Long
    
    Dim StartYear As String
    Dim StartMonth As String
    Dim StartDay As String
    Dim EndYear As String
    Dim EndMonth As String
    Dim EndDay As String
    
    Dim StartDay_S As String
    Dim EndDay_S As String
    
    Dim StartDay_I As Long
    Dim EndDay_I As Long
    
    If StartEnd = "Start" Then
        StartYear = [Forms]![frmMain]!actxCalendar90Start.Year
        StartMonth = [Forms]![frmMain]!actxCalendar90Start.Month
        StartDay = [Forms]![frmMain]!actxCalendar90Start.Day
        
        If Len(StartMonth) = 1 Then
            StartMonth = "0" & StartMonth
        End If
        
        If Len(StartDay) = 1 Then
            StartDay = "0" & StartDay
        End If
        
        StartDay_S = StartYear & StartMonth & StartDay
        StartDay_I = CLng(StartDay_S)
        DateRange90 = StartDay_I
        
    ElseIf StartEnd = "End" Then
        EndYear = [Forms]![frmMain]!actxCalendar90End.Year
        EndMonth = [Forms]![frmMain]!actxCalendar90End.Month
        EndDay = [Forms]![frmMain]!actxCalendar90End.Day
        
        If Len(EndDay) = 1 Then
            EndDay = "0" & EndDay
        End If
        
        If Len(EndMonth) = 1 Then
            EndMonth = "0" & EndMonth
        End If
        
        EndDay_S = EndYear & EndMonth & EndDay
        EndDay_I = CLng(EndDay_S)
        
        DateRange90 = EndDay_I
    End If
    

End Function

Answer : When ActiveX control on form changes, apply new value to another control on form.

Please let me suggest a different design pattern (This is what PayPal and other sophisticated sites use).

When you have a message for me, use the current DATETIME, my client id, and the message content and make up a message digest using md5().  Store my message and the md5() string in your data base.

Send me a plain-text email with a link to the message-reader script.  The script has the md5() key in the URL and it is only available behind HTTPS.

The script requires my client ID and password and validates these.  Then when I am authenticated it shows the message over the HTTPS web page.

In this design pattern you have essentially no risk of interception of the email -- anyone who sniffs it would still need to know the UID and Password.  And since you present the message over HTTPS, you do not need to encrypt anything, and your client does not need to decrypt anything - it is all automatic.  You could even use advanced HTML styling to make your message look nice!

Does that make sense for your app?

Best, ~Ray
Random Solutions  
 
programming4us programming4us