S
Stan
Hello All,
Ok, I have a text box with the current date in, and require a spinner to increase/decrease the date. I have managed to get it to work, however once the date gets passed the end of the month, the date that's displayed in the textbox goes crazy!
The code I have used (for the spinup button) is shown below:
Private Sub SpinButton2_Spinup()
SD = Date
SD = FormatDateTime(Date, vbShortDate)
If TextBox1.Value = "" Then
TextBox1.Value = Date
TextBox1 = FormatDateTime(TextBox1.Value, vbShortDate)
Else
If Not TextBox1.Value = "" Then
SD2 = TextBox1.Value
TextBox1.Value = FormatDateTime(SD2, vbShortDate)
SD2 = DateAdd("d", 1, SD2)
TextBox1.Value = SD2
TextBox1.Value = FormatDateTime(TextBox1.Value, vbShortDate)
End If
End If
End Sub
Does anyone know how to get the spinner to increase/decrease the date simply day by day, changing as it should throughout the year?
Any help on this would be greatly appreciated.
Thanks in advance,
Stan
Ok, I have a text box with the current date in, and require a spinner to increase/decrease the date. I have managed to get it to work, however once the date gets passed the end of the month, the date that's displayed in the textbox goes crazy!
The code I have used (for the spinup button) is shown below:
Private Sub SpinButton2_Spinup()
SD = Date
SD = FormatDateTime(Date, vbShortDate)
If TextBox1.Value = "" Then
TextBox1.Value = Date
TextBox1 = FormatDateTime(TextBox1.Value, vbShortDate)
Else
If Not TextBox1.Value = "" Then
SD2 = TextBox1.Value
TextBox1.Value = FormatDateTime(SD2, vbShortDate)
SD2 = DateAdd("d", 1, SD2)
TextBox1.Value = SD2
TextBox1.Value = FormatDateTime(TextBox1.Value, vbShortDate)
End If
End If
End Sub
Does anyone know how to get the spinner to increase/decrease the date simply day by day, changing as it should throughout the year?
Any help on this would be greatly appreciated.
Thanks in advance,
Stan