I have just tried to reuse a peice of code that I have used in several databases before and for some reason it is not working. Could someone have a glance over what follows to see what I have done wrong
Option Compare Database
Option Explicit
Dim WhichBox As Integer
Private Sub Atx_Cal_Click()
If WhichBox = 1 Then
txt_StaDat = atx_Cal.Value
End If
If WhichBox = 2 Then
txt_EndDat = atx_Cal.Value
End If
End Sub
Private Sub txt_StaDat_Enter()
WhichBox = 1
End Sub
Private Sub txt_EndDat_Enter()
WhichBox = 2
End Sub
What should happen is that if txt_StaDat has the focus, then when the user selects a value on the Calendar, then the value selected is placed in the txt box, But for some reason, probably a totally stupid oversight on my part, as soon as you click on the calendar, it gets focus and no value is put inthe txt box. On the other systems I use this method on, the calendar does not get focus, although it is not locked etc. I guess it must be a stupid setting I have missed somewhere
Regards
Option Compare Database
Option Explicit
Dim WhichBox As Integer
Private Sub Atx_Cal_Click()
If WhichBox = 1 Then
txt_StaDat = atx_Cal.Value
End If
If WhichBox = 2 Then
txt_EndDat = atx_Cal.Value
End If
End Sub
Private Sub txt_StaDat_Enter()
WhichBox = 1
End Sub
Private Sub txt_EndDat_Enter()
WhichBox = 2
End Sub
What should happen is that if txt_StaDat has the focus, then when the user selects a value on the Calendar, then the value selected is placed in the txt box, But for some reason, probably a totally stupid oversight on my part, as soon as you click on the calendar, it gets focus and no value is put inthe txt box. On the other systems I use this method on, the calendar does not get focus, although it is not locked etc. I guess it must be a stupid setting I have missed somewhere
Regards