When I use optional parameters, I always set them to a default value that I can trap... e.g.:
Public Function RunReport(CustomerID as Integer, Optional AsOfDate As Date = 0)
'The next line of code will set the variable 'AsOfDate' to todays date if the calling function didn't specify a date
If AsOfDate = 0 Then AsOfDate = Date
The problem seems though, that IsMissing isn't working correctly.
To double check, I Dimmed a Boolean and set it to IsMissing(param_name) put a breakpoint in and checked the value of it when the procedure was called without the optional argument. It remained false. I submit the code in hope that I've done something wrong and you can correct it.
'Enables or disables controls on form frmFindCourses depending on
'the value of the control's corresponding CheckBox.
Public Sub After_Update_Checkboxes(checkbox_name As CheckBox, _
control_name As Control, _
Optional changeCost As String, _
Optional eqOp As OptionGroup)
Dim form1 As Form, test As Boolean, test2 As Boolean
Set form1 = Form_frmFindCourses
'If the CheckBox is ticked...
If checkbox_name = True Then
'...then enable the CheckBox's corresponding control.
control_name.Enabled = True
test = IsMissing(eqOp)
test2 = Not test
If test Then
eqOp.Enabled = True
End If
If Not IsMissing(changeCost) Then
If IsNull(form1![Cost Type]) Then
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.