Combo box to update other fields.

  • Thread starter Thread starter Scott Viney
  • Start date Start date
S

Scott Viney

G'day All,

I have a sub form called sfrmCustomersQuotationDetails that displays all the
records for a certain client and quote.

In the subform I have a combo box that can be used to select the product for
the quote. What I want to happen is when the user selects this combo box
and picks an product the default price and tax values are written into
fields in the quote details. I have created and afterupdate event for the
combo box, but dont know how to code it to do this. This is abit out of my
league at the moment.

Private Sub Combo13_AfterUpdate()

frmCustomersQuotationDetails!sfrmCustomersQuotationDetails![QuotationProduct
VRUnit] =
frmCustomersQuotationDetails!sfrmCustomersQuotationDetails!Combo13.Column(3)

frmCustomersQuotationDetails!sfrmCustomersQuotationDetails![QuotationProduct
IVA] =
frmCustomersQuotationDetails!sfrmCustomersQuotationDetails!Combo13.Column(4)
End Sub

If anyone can help me, cheers

Scott V
 
well, looks like your concept is correct. double check that you have the
correct columns indicated, keeping in mind that combo box columns are
zero-based, meaning the first column is (0), the second column is (1), etc.
you don't need to explicitly reference the entire form hierarchy, though.
try

Private Sub Combo13_AfterUpdate()

With Me
.QuotationProductVRUnit = .Combo13.Column(3)
.QuotationProductIVA = .Combo13.Column(4)
End With

End Sub

note: if there are no spaces in a field name, you don't need to use
brackets around it.

hth


Scott Viney said:
G'day All,

I have a sub form called sfrmCustomersQuotationDetails that displays all the
records for a certain client and quote.

In the subform I have a combo box that can be used to select the product for
the quote. What I want to happen is when the user selects this combo box
and picks an product the default price and tax values are written into
fields in the quote details. I have created and afterupdate event for the
combo box, but dont know how to code it to do this. This is abit out of my
league at the moment.

Private Sub Combo13_AfterUpdate()

frmCustomersQuotationDetails!sfrmCustomersQuotationDetails![QuotationProduct
VRUnit] =
frmCustomersQuotationDetails!sfrmCustomersQuotationDetails!Combo13.Column(3)frmCustomersQuotationDetails!sfrmCustomersQuotationDetails![QuotationProduct
IVA] =
frmCustomersQuotationDetails!sfrmCustomersQuotationDetails!Combo13.Column(4)
End Sub

If anyone can help me, cheers

Scott V
 
Gracias Tina,

I used you coding, I must of spelt something incorrectly, because it now
works as a charm.

Have a good one,
Scott

tina said:
well, looks like your concept is correct. double check that you have the
correct columns indicated, keeping in mind that combo box columns are
zero-based, meaning the first column is (0), the second column is (1), etc.
you don't need to explicitly reference the entire form hierarchy, though.
try

Private Sub Combo13_AfterUpdate()

With Me
.QuotationProductVRUnit = .Combo13.Column(3)
.QuotationProductIVA = .Combo13.Column(4)
End With

End Sub

note: if there are no spaces in a field name, you don't need to use
brackets around it.

hth


Scott Viney said:
G'day All,

I have a sub form called sfrmCustomersQuotationDetails that displays all the
records for a certain client and quote.

In the subform I have a combo box that can be used to select the product for
the quote. What I want to happen is when the user selects this combo box
and picks an product the default price and tax values are written into
fields in the quote details. I have created and afterupdate event for the
combo box, but dont know how to code it to do this. This is abit out of my
league at the moment.

Private Sub Combo13_AfterUpdate()
frmCustomersQuotationDetails!sfrmCustomersQuotationDetails![QuotationProduct
VRUnit] =
frmCustomersQuotationDetails!sfrmCustomersQuotationDetails!Combo13.Column(3)frmCustomersQuotationDetails!sfrmCustomersQuotationDetails![QuotationProduct
frmCustomersQuotationDetails!sfrmCustomersQuotationDetails!Combo13.Column(4)
End Sub

If anyone can help me, cheers

Scott V
 
you're welcome, glad you got it to work. :)


Scott Viney said:
Gracias Tina,

I used you coding, I must of spelt something incorrectly, because it now
works as a charm.

Have a good one,
Scott

tina said:
well, looks like your concept is correct. double check that you have the
correct columns indicated, keeping in mind that combo box columns are
zero-based, meaning the first column is (0), the second column is (1), etc.
you don't need to explicitly reference the entire form hierarchy, though.
try

Private Sub Combo13_AfterUpdate()

With Me
.QuotationProductVRUnit = .Combo13.Column(3)
.QuotationProductIVA = .Combo13.Column(4)
End With

End Sub

note: if there are no spaces in a field name, you don't need to use
brackets around it.

hth


all
the product
for of
my
frmCustomersQuotationDetails!sfrmCustomersQuotationDetails![QuotationProduct
frmCustomersQuotationDetails!sfrmCustomersQuotationDetails!Combo13.Column(3)frmCustomersQuotationDetails!sfrmCustomersQuotationDetails![QuotationProduct
frmCustomersQuotationDetails!sfrmCustomersQuotationDetails!Combo13.Column(4)
 
Back
Top