LittleRedHat
Instructor
I have created an order form with a sub form based on Northwind. When I attempt to enter a product without first entering the customer I get "You have tried to assign the null value to a variable that is not the variant data type".
(Once ok'd all then runs as intended, i.e my error message is displayed, the boxes are cleared and the focus moves to customer.)
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr > 0 Then
If IsNull(Me.Parent!CustNo) Then
MsgBox "Please select a customer before entering order details", , "Mini Wheels"
RunCommand acCmdUndo
Me.Parent!CustNo.SetFocus
Response = acDataErrContinue
Else
Response = acDataErrDisplay
End If
End If
End Sub
~~~~~~~~~~~~~~~~~~~
I'm using a Combo Box that doesn't display the number but customer title and names with this the row source ...
SELECT DISTINCT [Customer].[CustNo] AS Expr1, [Customer].[Last_Name] AS Expr2, [Customer].[First_Name] AS Expr3 FROM Customer ORDER BY [Customer].[Last_Name];
~~~~~~~~~~~~~~~~~~~
I'd be grateful for any clues as to how to resolve.
WTA
LRH
(Once ok'd all then runs as intended, i.e my error message is displayed, the boxes are cleared and the focus moves to customer.)
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr > 0 Then
If IsNull(Me.Parent!CustNo) Then
MsgBox "Please select a customer before entering order details", , "Mini Wheels"
RunCommand acCmdUndo
Me.Parent!CustNo.SetFocus
Response = acDataErrContinue
Else
Response = acDataErrDisplay
End If
End If
End Sub
~~~~~~~~~~~~~~~~~~~
I'm using a Combo Box that doesn't display the number but customer title and names with this the row source ...
SELECT DISTINCT [Customer].[CustNo] AS Expr1, [Customer].[Last_Name] AS Expr2, [Customer].[First_Name] AS Expr3 FROM Customer ORDER BY [Customer].[Last_Name];
~~~~~~~~~~~~~~~~~~~
I'd be grateful for any clues as to how to resolve.
WTA
LRH