G
Guest
I am trying to get the correct syntax for allowing a SubForm to update in
response to a Combo box control update.
I am using the ComboBox_AfterUpdate Event, and I am building a Query String
which references the ComboBox value (i.e. SELECT Field1, Field2 FROM
TableName WHERE Field3.TableName = Forms!SubFormName!NameOfComboBoxControl).
I then set the query string to the SourceObject of the SubForm and Call a
Requery Event for the SubForm.
My Code looks something like this.....
Private Sub Combo0_AfterUpdate()
Dim SQLCommand As String
SQLCommand = "SELECT PurchaseOrderDetails.ProductID,
PurchaseOrderDetails.ProductQuantity FROM PurchaseOrderInvoice INNER JOIN
PurchaseOrderDetails ON PurchaseOrderInvoice.PurchaseOrderNumber =
PurchaseOrderDetails.PurchaseOrderNumber WHERE
(((PurchaseOrderInvoice.PurchaseOrderNumber)=Forms!.Form3!.Combo0));"
Me.SubForm.SourceObject = SQLCommand
Me.SubForm.Requery
End Sub
I get a range of errors when I try and run this code, and I am wondering if
there is a specific syntax/ methodology for updating sub forms on a requery,
and if there is a limit to the length of the query string which can be passed
to the SubForm.SourceObject Property.
Can anyone elaborate....
response to a Combo box control update.
I am using the ComboBox_AfterUpdate Event, and I am building a Query String
which references the ComboBox value (i.e. SELECT Field1, Field2 FROM
TableName WHERE Field3.TableName = Forms!SubFormName!NameOfComboBoxControl).
I then set the query string to the SourceObject of the SubForm and Call a
Requery Event for the SubForm.
My Code looks something like this.....
Private Sub Combo0_AfterUpdate()
Dim SQLCommand As String
SQLCommand = "SELECT PurchaseOrderDetails.ProductID,
PurchaseOrderDetails.ProductQuantity FROM PurchaseOrderInvoice INNER JOIN
PurchaseOrderDetails ON PurchaseOrderInvoice.PurchaseOrderNumber =
PurchaseOrderDetails.PurchaseOrderNumber WHERE
(((PurchaseOrderInvoice.PurchaseOrderNumber)=Forms!.Form3!.Combo0));"
Me.SubForm.SourceObject = SQLCommand
Me.SubForm.Requery
End Sub
I get a range of errors when I try and run this code, and I am wondering if
there is a specific syntax/ methodology for updating sub forms on a requery,
and if there is a limit to the length of the query string which can be passed
to the SubForm.SourceObject Property.
Can anyone elaborate....