If function

A

a

Hi

I am trying to make a price field (Dup_Price) in a subform take on 2
different sets of prices depending on the value selected from the Order
field (which has 2 options - "Takeaway" & "Dining In" and is on the form
Frm_Orders).

The following code appears in the after update event of the ProductCode
field which is a combo box with the row source containing 4 sets of data .

Column contains 0 ProductCode, Column 1 ProductName, Column 2 price set 1,
column 3 contains price set 2.

Private Sub ProductCode_AfterUpdate()
If Forms!Frm_Orders!Order = "Takeaway" Then
Me.Dup_Price = Me.ProductCode.Column(2)
Else
Me.Dup_Price = Me.ProductCode.Column(3)
End If
End Sub

The correct price only works if "Takeaway" is selected in the Order field.
If "Dining In" is selected then nothing appears in the Dup_Price field, it
appears blank.

Any ideas as to what im doing wrong?

Many thanks in advance

Pinky
 
S

Steve Schapel

Pinky,

Even though the combobox's rowsource query contains 4 fields, the type
of code you are using will only work if the Column Count property of
the combobox is also set to 4. Is this what you've got?

- Steve Schapel, Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top