Autofill Continous Form (1 Viewer)

jerem

Registered User.
Local time
Tomorrow, 00:00
Joined
May 1, 2012
Messages
118
Hi,
I have been looking for a solution but I don't find:

I have a form with a subform (continuous) with cascading comboboxes. All this works fine. cboCollectionID filters cboLineItemCodeID. What I would like is to be able to generate an entire collection by choosing the collection in the cboCollectionID if needed (triggered by a chkbox for example). What I get stuck with is the code to autofill the continuous subform. Here is my code:

Code:
Dim Autofill As Database
Set Autofill = CurrentDb
Autofill.Execute " INSERT INTO QuoteLineItems ( LineItemCodeID, CollectionID, UnitPrice, QuoteID ) " _
& " SELECT LineItemCodes.ID, LineItemCodes.CollectionID, LineItemCodes.DefaultUnitPrice, [txtID] AS QuoteID " _
& " FROM LineItemCodes " _
& " WHERE (((LineItemCodes.CollectionID)= [cboCollectionID])); "
Autofill.Close
End Sub

I tested the SQL on a separate query and it works (On that test query, I need to type [txtID] and [cboCollectionID] manually obviously) but when I put it as a code in the afterupdate event of my cboCollection I get an error: missing paramter. Epected 2.

Thank you for your help!
 

Users who are viewing this thread

Top Bottom