dazz2302
07-22-2010, 09:32 PM
Hi folks,
Could someone see where I am going wrong with this AfterUpdate event that I have on a form named INVOICELOG:
What i am trying to do is an after Update event that is assigned to a combo box field. When a combo box selection is made, a running total in the [CONTRACTAMTEXCGST] field (data type currency) is then populated.
In other words:
SELECT: DSum [CONTRACTAMTEXCGST] (Currency field)
FROM: [CONTRACTS] table
WHERE: Combo box selection named [CRCREFERENCE] = CRCREFERENCE field in the [CONTRACTS] table.
The following code was entered in under CRCREFERENCE property events.
Private Sub CRCREFERENCE_AfterUpdate()
CONTRACTAMTEXCGST = DSum("[CONTRACTAMTEXCGST]", "[CONTRACTS]", "[CRCREFERENCE]='" + cboCRCREFERENCE + "' ")
End Sub
The result is a blank field against CONTRACTAMTEXCGST when a selection is made in the CRCREFERENCE combo box.
A relationship exists against the two tables.
As a newbie, i know this is code is wrong in my attempt but any help in identifying a possible solution would be greatly appreicated.
Many Thanks
Dazz
Could someone see where I am going wrong with this AfterUpdate event that I have on a form named INVOICELOG:
What i am trying to do is an after Update event that is assigned to a combo box field. When a combo box selection is made, a running total in the [CONTRACTAMTEXCGST] field (data type currency) is then populated.
In other words:
SELECT: DSum [CONTRACTAMTEXCGST] (Currency field)
FROM: [CONTRACTS] table
WHERE: Combo box selection named [CRCREFERENCE] = CRCREFERENCE field in the [CONTRACTS] table.
The following code was entered in under CRCREFERENCE property events.
Private Sub CRCREFERENCE_AfterUpdate()
CONTRACTAMTEXCGST = DSum("[CONTRACTAMTEXCGST]", "[CONTRACTS]", "[CRCREFERENCE]='" + cboCRCREFERENCE + "' ")
End Sub
The result is a blank field against CONTRACTAMTEXCGST when a selection is made in the CRCREFERENCE combo box.
A relationship exists against the two tables.
As a newbie, i know this is code is wrong in my attempt but any help in identifying a possible solution would be greatly appreicated.
Many Thanks
Dazz