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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting form fields to populate table fields

Status
Not open for further replies.

voltarei

Technical User
Oct 25, 2006
40
GB
Hi all,
Having trawled through the forums to no avail, I wonder if anyone can tell me how I can get the fields on a form, to populate a table.

I have a very basic database that tracks customers and their orders.
I have a customer details, product details, travel costs, and employee details tables.
I also have an orders table, and an orders form, both of which take their information from a query that incorporates all the other tables which are linked.

The form works like magic, and autofills customer details, product details and travel costs when the relevant selections are made from combo boxes.
The financial side also works great, with subtotals, discounts, VAT and grand totals all being calculated by various codes I have added to the form fields.

The trouble I have is that although the customer details, employee details and other non-financial details are populated on the orders table, none of the monetary fields are, and remain blank.

Could anyone give me any advice on where I am going wrong?

I am a novice at creating databases and am using Access 2003.

Many thanks
Phil
 
I imagine the fields you have on the form that show calculated values (VAT, Discount, etc) are unbound. Meaning they are not linked to a field in the table.

If you go into the control properties you will see the control source is an expression for the calculated fields and a field name from the table for the other fields.

You will need to write some code that sends the calculated value in the text box to the table.

Here is an example using a button event to send a value from a textbox to a field in the underlying table.

Private Sub btnSaveValue_Click()
Me!VAT = Me.txtVAT
End Sub

Use Me!"FieldName" to ref field in table & Me."ControlName" to ref control on form...
 
Many thanks for the advice.
In addition to the "calculated" fields on the form not populating the table (due to them being unbound as you suggested), there are two other fields that also remain blank in the table, although populated on the form.

I have a table called Products containing
Product Name (primary Key)
Price

and a table called Zone ID Details containing
Zone ID (primary Key)
Cost

These two tables are linked to the Orders table.
On the query that is used for both the table and the form, the Product Name & Zone ID columns are taken from the Orders table, and the Price & Cost columns from the individual tables above.

Neither of the Price & Cost fields is populated in the Orders table, even though they autofill on the form.

Any suggestions?
 
even though they autofill on the form
they autofill bound controls on the form ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top