using form to stop incorrect orders

  • Thread starter Thread starter nevje
  • Start date Start date
N

nevje

on an order processing form i need each order to be of all the same type
of products - each product is of type 1, 2 or 3.

i use a combo box to choose the product and can have multiple products
on each order .... what i want is if the user chooses a product for the
order that is not of the orders specified type (either type 1, 2 or 3)
then it errors and does not allow the product to be chosen or added.

how can i achieve this?
 
I presume the order type is specified in the main Orders table, not the
OrderDetails table?
Then when it changes in the Orders record, you can refilter the combobox on
your subform to display only products of that type.

HTH
- Turtle
 
I presume the order type is specified in the main Orders table, not the
OrderDetails table?
Then when it changes in the Orders record, you can refilter the combobox on
your subform to display only products of that type.

HTH
- Turtle

yes, in the main orders table i have:-

orderNo
orderDate
orderType

also, in the main products table the products also have a 'type' fied.

as the orders are entered from hand written instructions from site im
after the order entry form telling the person inputting the order that
they cant use that product on this order as this order is for products
of 'type1' or 'type2', etc. this is to help reduce errors from both the
site person and the in order entry as the order entry can call site and
confirm the actual product they want, etc.
 
I presume the order type is specified in the main Orders table, not the
OrderDetails table?
Then when it changes in the Orders record, you can refilter the combobox on
your subform to display only products of that type.

HTH
- Turtle

yes, although i read this earlier it didnt actually sink in until a
minute ago .... thanks.
 
I presume the order type is specified in the main Orders table, not the
OrderDetails table?
Then when it changes in the Orders record, you can refilter the combobox on
your subform to display only products of that type.

HTH
- Turtle

ok, so the combo box will only show the correct type of products that
can be picked. is the filter set on the combo box or on the subform, but
more importanly how is it done? ;) ....
 
I'd suggest filtering the combobox.
Say its RowSource is now
SELECT ProdID, ProdName FROM tblProducts

In your main form's OrderType textbox's AfterUpdate, you could do something
like this:
Me!sfmDetails.Form!cboType.RowSource = "SELECT ProdID, ProdName FROM
tblProducts WHERE ProdType=" & Me!OrderType

Of course you'll have to substitute a lot of your own control names here -
and adjust the WHERE clause if OrderType is not numeric.

HTH
- Turtle
 
Back
Top