I have a form that auto-populates 10 fields using a Dlookup in the got focus event of each field. The dlookup searches the "DNM TEST Form Query" query based on two criteria: Sales Order # and SKU. This works perfectly, but... the end user would also like 5 of the fields to autopopulate when only SKU is entered. If only SKU is entered, I have to dlookup using only SKU as criteria from a different query- "Product Info Query".
I'm trying this as an If statement on the first autopopulate field only, but it's not working - I get no autopopoulate results and no error message.
Here's the code I'm trying:
Private Sub Pattern_Name_GotFocus()
If (Not (IsNull(Sales_Order)) Or (Sales_Order <> "")) Then
Me.Pattern_Name = DLookup("[PATTERN]", "DNM TEST Form Query", "[Sales Order Number]=Forms![Backorder Inquiry Form]![Sales Order]And[SKU]=Forms![Backorder Inquiry Form]![SKU]")
Else
Me.Pattern_Name = DLookup("[Pattern]", "Product Info Query", "[SKU]=Forms![Backorder Inquiry Form]![SKU]")
End If
End Sub
I'm trying this as an If statement on the first autopopulate field only, but it's not working - I get no autopopoulate results and no error message.
Here's the code I'm trying:
Private Sub Pattern_Name_GotFocus()
If (Not (IsNull(Sales_Order)) Or (Sales_Order <> "")) Then
Me.Pattern_Name = DLookup("[PATTERN]", "DNM TEST Form Query", "[Sales Order Number]=Forms![Backorder Inquiry Form]![Sales Order]And[SKU]=Forms![Backorder Inquiry Form]![SKU]")
Else
Me.Pattern_Name = DLookup("[Pattern]", "Product Info Query", "[SKU]=Forms![Backorder Inquiry Form]![SKU]")
End If
End Sub