G
Ginger
I have a form and a subform. The form shows events, and the
subform shows event expenses with an inserted subtable for
expandable line items for each record in the subform. The
relationship between the form and subform is "EventID".
If there are no expenses for that event, the subform should
be blank.
I need to be able to update the subform, when the form
opens and when the textbox for the "EventID" changes.
I have set up the following code: but even when I go to a
record that I know has event expenses, the subform shows no
data.
Here is the code:
Public Sub UpdateSubForm()
Dim strSQL As String
strSQL = "Select DISTINCTROW
tblExpenses.ExpenseSummaryID, tblExpenses.EventID,
Sum(tblExpenses.Quantity) AS [Sum Of Quantity],
Sum(tblExpenses.Cost) AS [Sum Of Cost]"
FROM tblExpenses
WHERE [tblExpenses.EventID] =
[Forms]![frmEventSummary]![txtEventID].[AfterUpdate]
GROUP BY(tblExpenses.ExpenseSummaryID),
(tblExpenses.EventID)
'set the subform to strSQL
subfrmEventExp.Form.RecordSource = strSQL
subfrmEventExp.Requery
End Sub
Thank you in advance for your assistance.
Ginger
subform shows event expenses with an inserted subtable for
expandable line items for each record in the subform. The
relationship between the form and subform is "EventID".
If there are no expenses for that event, the subform should
be blank.
I need to be able to update the subform, when the form
opens and when the textbox for the "EventID" changes.
I have set up the following code: but even when I go to a
record that I know has event expenses, the subform shows no
data.
Here is the code:
Public Sub UpdateSubForm()
Dim strSQL As String
strSQL = "Select DISTINCTROW
tblExpenses.ExpenseSummaryID, tblExpenses.EventID,
Sum(tblExpenses.Quantity) AS [Sum Of Quantity],
Sum(tblExpenses.Cost) AS [Sum Of Cost]"
FROM tblExpenses
WHERE [tblExpenses.EventID] =
[Forms]![frmEventSummary]![txtEventID].[AfterUpdate]
GROUP BY(tblExpenses.ExpenseSummaryID),
(tblExpenses.EventID)
'set the subform to strSQL
subfrmEventExp.Form.RecordSource = strSQL
subfrmEventExp.Requery
End Sub
Thank you in advance for your assistance.
Ginger