Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 8th, 2003, 07:09 PM
Registered User
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Stever
Default Beginner

I have a table with 3 fields (columns). I have a form with 3 fields bound to the 3 fields in the table. I want field C calculate field B minus field C and return this value to the table. By using an expression as the control source I am able to make the calculation on the form but I am taking away the binding to the field in the table. How can I calculate this and still retain the binding to the field?
Old June 9th, 2003, 12:27 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts

For starters, I wouldn't suggest having a field that is just calculated - you can just run a query that will automatically. With a query such as:

SELECT Field1, Field2, [Field1]-[Field2] AS Difference
FROM Table1;
If you want it displayed on the form, you can just have an unbound textbox with the control source being something along the lines of:

Storing the difference of the two would just take up space.

HOWEVER, having said that
If, for some strange reason you REALLY REALLY need to have it stored, you could put some code into the form's BeforeUpdate event to calcutate the difference, or on some other event, such as the OnEnter event of the field.



Similar Threads
Thread Thread Starter Forum Replies Last Post
c++ beginner, need help please jmarsh56 Visual C++ 0 December 7th, 2005 10:38 AM
Beginner Tilak_1 C# 2 January 21st, 2005 11:19 PM
Beginner c.j.rowell@ntlworld.com Beginning PHP 4 December 23rd, 2004 03:22 PM
Need help - C++ beginner Satheesh C++ Programming 13 August 7th, 2004 09:18 PM
Beginner programmed XML 3 February 21st, 2004 05:12 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.