Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

Calculated or Entered Value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill - 20 Apr 2008 15:18 GMT
Hi All,

Is there anyway to have a field in a table as either a calculated or an
entered value. I'm thinking of a circumstance where if a value is present in
another the value is calculated, otherwise it is entered. Or am I missing
something really basic!!

Cheers.
Bill
John Spencer - 20 Apr 2008 15:24 GMT
You can't do that in a query or a table, but you can do it on a form
using VBA to assign a value to a control bound to a field or allowing
you to type directly into the control.

You would probably need to assign the value in the form's current event
and if the source field value was enterable then in the after update
event of the control bound to the source field.

'====================================================
 John Spencer
 Access MVP 2002-2005, 2007-2008
 Center for Health Program Development and Management
 University of Maryland Baltimore County
'====================================================

> Hi All,
>
[quoted text clipped - 5 lines]
> Cheers.
> Bill
Rick Brandt - 20 Apr 2008 15:27 GMT
> Hi All,
>
[quoted text clipped - 5 lines]
> Cheers.
> Bill

You can do this in a form which is where all data entry should happen.

In the AfterUpdate event of the "other" control you perform the calculation
and push the result into the control that should hold that value.

In the BeforeUpdate event of the control holding your calculated value you
can check to see if a value is present in the other control and if so...

MsgBox "Manual Entry Not Allowed"
Cancel = True
Me.ControlName.Undo

As long as the other control is empty then manual entry would be allowed.

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

Bill - 21 Apr 2008 16:28 GMT
Thanks both for the replies.

I will go and have a think!!!

Cheers.
Bill.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.