Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating record with unbounded field linked to subform

Status
Not open for further replies.

kedrew

Programmer
Jun 22, 2001
29
US
I am revising a product sales system that contains two tables (for discussion purposes). The first table is 'orders', and the second is 'order details'.

The orders table contains an unbounded field 'sales tax', which is calculated using a second unbounded text-box that displays the subtotal. The subtotal is retrived from a summary object on appearing on the 'order details' subform (control source:
Code:
=[<subform>].Forms![subtotal]
).

Because the tax rate may change, thereby affecting the validity of our database; the fact that we only collect tax from one state; and backwards compatiblity issues, I do not see how I can remove the field (tax) from the table and work on a calculated basis for my reports/queries.

I have tried to use the OnChange and AfterUpdate events of the unbounded control to write the value from the unbounded 'sales tax' to the order table's 'tax' field, but neither seem to be working. I also tried 'OnDirty' from the form, but that didn't do it either.

I have several different buttons on the form that rely upon the sales tax data (pulled from the database by the called object). While I could add a 'UpdateTax' statement to each button and again on the report's OnClose, I'm thinking/hoping that there is a better method to achive this goal.

Thanks in advance,
 
Save record on any procedure (may on one of your designate). Then requery subform and go to previouse (ie. current) subform's record if it's needed.

dim rst as recordset
dim MyID docmd.RunCommand acCmdSaveRecord

MyID=me.subformName.form.ID
me.subformName.form.requery
set rst=me.subformName.form.recordsetclone
rst.findfirst &quot;ID=&quot; & MyID 'Use needed separators for text or date type fields
if not rst.nomatch then
me.subformName.form.bookmark=rst.bookmark
end if
rst.close
set rst=nothing

I hope this would be helped you.
Aivars
 
Thanks for the suggestion, as I did settle on placing a call to the function to do the calculation in each button.

I don't think it's the cleanest solution, but it will get the job done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top