Question Locked

How do I use the Active X UpDown Control (Comct232) in Access 2000 Forms?

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Never used it before. Not immediatly obvious. Need to add this type of control to a form.

Range of values betwen 1-999
default null on new record but 'on-enter' or 'on-click' the value defaults to mid range say 500 and then up & down to select the value .
The Selected Value will need to be stored in the corresponding field / Data Source.

I alreadt have the 'UpDown' Control on the form and have positioned a txtBox beside it...so how do I get them to work together?...

2 replies

by hfeddema

Here is some code:

Private Sub ocxUpDown_DownClick()
'Created by Helen Feddema 15-Oct-2007
'Last modified 15-Oct-2007

On Error GoTo ErrorHandler

If IsDate(Me![txtPicnicDate].Value) = True Then
dtePicnicOriginal = CDate(Me![txtPicnicDate].Value)
dtePicnicNew = DateAdd("d", -1, dtePicnicOriginal)
Me![txtPicnicDate].Value = dtePicnicNew
End If

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit

End Sub

Private Sub ocxUpDown_UpClick()
'Created by Helen Feddema 15-Oct-2007
'Last modified 15-Oct-2007

On Error GoTo ErrorHandler

If IsDate(Me![txtPicnicDate].Value) = True Then
dtePicnicOriginal = CDate(Me![txtPicnicDate].Value)
dtePicnicNew = DateAdd("d", 1, dtePicnicOriginal)
Me![txtPicnicDate].Value = dtePicnicNew
End If

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit

End Sub

I am working on an Access Archon article on this topic -- see my Web site for the article (http://www.helenfeddema.com)

This discussion is closed to new replies.