T
Todd H
I have a budget management application, and the budget information
goes into tblProjectLineItems. I have three “set up” records that I
want to automate. When I enter the budget (I have a form/query to do
this), I want to automatically populate the other two “set up”
records. In addition I have another table, tblPayments, that I track
the project/actual cost by cost code; I want to populate this record
as well.
I think the DoCmd.RunSQL is the proper function, but I can’t seem to
get the syntax correct. I also want to “silence” this operation (no
confirmation dialogs).
Private Sub CostCode_AfterUpdate()
'DoCmd.RunSQL "INSERT INTO tblProjectLineItems (CostCode, Amount,
BMNo, Contract) VALUES (" & Me.CostCode & ",0,9999,” N/A “);"
'DoCmd.RunSQL "INSERT INTO tblProjectLineItems (CostCode, Amount,
BMNo, Contract) VALUES (" & Me.CostCode & ",0,0000,” N/A “);"
'DoCmd.RunSQL "INSERT INTO tblPayments (CostCode,ActualCost,
ProjectedCost, BillingPeriodNo, Contract) VALUES (" & Me.CostCode & ",
0, 0,1,” N/A “);"
End Sub
tblProjectLineItems; CostCode is text, Amount is Currency, BMNo is
number, Contract is text
tblPayments; CostCode is text, Actual/ProjectedCost is currency,
BillingPeriodNo is number, Contract is text
Any help is appreciated. Thanks, Todd
goes into tblProjectLineItems. I have three “set up” records that I
want to automate. When I enter the budget (I have a form/query to do
this), I want to automatically populate the other two “set up”
records. In addition I have another table, tblPayments, that I track
the project/actual cost by cost code; I want to populate this record
as well.
I think the DoCmd.RunSQL is the proper function, but I can’t seem to
get the syntax correct. I also want to “silence” this operation (no
confirmation dialogs).
Private Sub CostCode_AfterUpdate()
'DoCmd.RunSQL "INSERT INTO tblProjectLineItems (CostCode, Amount,
BMNo, Contract) VALUES (" & Me.CostCode & ",0,9999,” N/A “);"
'DoCmd.RunSQL "INSERT INTO tblProjectLineItems (CostCode, Amount,
BMNo, Contract) VALUES (" & Me.CostCode & ",0,0000,” N/A “);"
'DoCmd.RunSQL "INSERT INTO tblPayments (CostCode,ActualCost,
ProjectedCost, BillingPeriodNo, Contract) VALUES (" & Me.CostCode & ",
0, 0,1,” N/A “);"
End Sub
tblProjectLineItems; CostCode is text, Amount is Currency, BMNo is
number, Contract is text
tblPayments; CostCode is text, Actual/ProjectedCost is currency,
BillingPeriodNo is number, Contract is text
Any help is appreciated. Thanks, Todd