flect
02-10-2009, 03:59 PM
Hi folks
I'm trying to do a bit of cleanup on my db at the moment and i'm running into a problem with a combo box on my form.
the main elements are the form - frmNavigation
the combo box in question - cmbDistributionOrder
and the button - btnNewOrder
What i'm trying to do is create a simple msgbox when someone clicks the button to create a new order but hasn't selected from the combo box - should be pretty straightforward but something's not working.
Private Sub btnNewOrder_Click()
Dim intanswer As Integer
If Forms!frmnavigation!cmbDistributionOrder is Null Then
intanswer = _
MsgBox("No Distribution selected, please select from list", vbInformation + vbOKOnly, "Select Distribution")
Else
Forms!frmnavigation.Visible = False
DoCmd.Minimize
DoCmd.openForm ("tblOrder"), acNormal, , , acFormAdd
End IfcmbDistributionOrder is unbound with the row source
SELECT Distribution.DistributionNumber, Distribution.DistributionDate FROM Distribution ORDER BY Distribution.DistributionDate DESC; The message box works fine if i change the code to work with a numerical value
e.g:
If Forms!frmnavigation!cmbDistributionOrder > 500 works, but obviously only after updating and that's not what i want to happen.
so i'm guessing 'null' isn't the correct thing to use for an empty combo box.
any ideas? :cool:
I'm trying to do a bit of cleanup on my db at the moment and i'm running into a problem with a combo box on my form.
the main elements are the form - frmNavigation
the combo box in question - cmbDistributionOrder
and the button - btnNewOrder
What i'm trying to do is create a simple msgbox when someone clicks the button to create a new order but hasn't selected from the combo box - should be pretty straightforward but something's not working.
Private Sub btnNewOrder_Click()
Dim intanswer As Integer
If Forms!frmnavigation!cmbDistributionOrder is Null Then
intanswer = _
MsgBox("No Distribution selected, please select from list", vbInformation + vbOKOnly, "Select Distribution")
Else
Forms!frmnavigation.Visible = False
DoCmd.Minimize
DoCmd.openForm ("tblOrder"), acNormal, , , acFormAdd
End IfcmbDistributionOrder is unbound with the row source
SELECT Distribution.DistributionNumber, Distribution.DistributionDate FROM Distribution ORDER BY Distribution.DistributionDate DESC; The message box works fine if i change the code to work with a numerical value
e.g:
If Forms!frmnavigation!cmbDistributionOrder > 500 works, but obviously only after updating and that's not what i want to happen.
so i'm guessing 'null' isn't the correct thing to use for an empty combo box.
any ideas? :cool: