Listbox to datasheet subform

S

Scott Viney

Hi All,

Hi All,

I have a form for my quotation details. On it is a combo box for the brand
name that links to a list box. Select the combo box and it requeries the
list box with only the products for that brand. Perfect!

Also I have a subform that lists all the details for this quotation. I want
the dblclick event for the list box item to add this data to a new record in
the quotation details subform.

I have posted my code for the double click event below.

Can someone show me how to get the data to go in a new record?

Also if I position the record selector in the subform manually at the new
record position and double click an item I get the following ´Runtime Error
´31654´ Field cannot be updated´ It stops at the 'Product Sapiens Code'
lines. If I do the same on an existing record everything works fine.

Any help would be appreciated,
Scott V

Private Sub lstProductos_DblClick(Cancel As Integer)

With Me

'Product ID

sfrmQuotationDetails.Controls.Item("txtProductID") =
..lstProductos.Column(0)

'Product Brand Name

sfrmQuotationDetails.Controls.Item("txtBrandName") =
..cboBrandID.Column(1)

'Product Sapiens Code

sfrmQuotationDetails.Controls.Item("txtProductSapiensCode") =
..lstProductos.Column(1)

'Product Brand Code

sfrmQuotationDetails.Controls.Item("txtProductBrandCode") =
..lstProductos.Column(2)

'Product Description

sfrmQuotationDetails.Controls.Item("txtProductDescription") =
..lstProductos.Column(3)

'Product Presentation

sfrmQuotationDetails.Controls.Item("txtPresentationType") =
..lstProductos.Column(4)

'Product Size

sfrmQuotationDetails.Controls.Item("txtProductSize") =
..lstProductos.Column(5)

'Product Has IVA

sfrmQuotationDetails.Controls.Item("chkProductHasIVA") =
..lstProductos.Column(6)

'Product VR Unit Price

sfrmQuotationDetails.Controls.Item("txtQuotationProductVRUnit") =
..lstProductos.Column(7)

'Product IVA

sfrmQuotationDetails.Controls.Item("txtQuotationProductIVA") =
..lstProductos.Column(8)

End With

End Sub
 
Top