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 / Forms / May 2007

Tip: Looking for answers? Try searching our database.

What event when I click the record selector

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alan T - 22 May 2007 02:01 GMT
I have some labels on the form would like to populate its value (they are
calculated values) when I select the record selector, next, previous or last
or first.

What event should I write the code into?
John W. Vinson - 22 May 2007 02:36 GMT
>I have some labels on the form would like to populate its value (they are
>calculated values) when I select the record selector, next, previous or last
>or first.
>
>What event should I write the code into?

Well, don't use Labels for this purpose; use textboxes instead, with their
Control Source set to the expression. Doing so will display the calculated
value with no code at all.

            John W. Vinson [MVP]
Alan T - 22 May 2007 07:55 GMT
Hi,
My calculated fields do not exists in the table, I need to calculate on the
fly.
So I cannot link the text box/label to the recordset.

> On Tue, 22 May 2007 11:01:23 +1000, "Alan T"
> <alanpltseNOSPAM@yahoo.com.au>
[quoted text clipped - 12 lines]
>
>             John W. Vinson [MVP]
Rick Brandt - 22 May 2007 12:47 GMT
> Hi,
> My calculated fields do not exists in the table, I need to calculate
> on the fly.
> So I cannot link the text box/label to the recordset.

That is not what John suggested.  A TextBox can have an expression as its
ControlSource and thus display a value that has nothing to do with the form's
RecordSource.

Signature

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

John W. Vinson - 23 May 2007 04:00 GMT
>My calculated fields do not exists in the table, I need to calculate on the
>fly.

Then do so.

You can set the Control Source of a textbox to

=(([FieldA] + [FieldB]) / IIF([FieldC] > [FieldD], [FieldC], [FieldD])

or any other expression that you choose.

            John W. Vinson [MVP]
Alan T - 28 May 2007 03:53 GMT
I understand it but my calculated fields depends on fields of other tables.
I need to run a query may have a SUM(..) in the SELECT part.

> On Tue, 22 May 2007 16:55:24 +1000, "Alan T"
> <alanpltseNOSPAM@yahoo.com.au>
[quoted text clipped - 13 lines]
>
>             John W. Vinson [MVP]
John W. Vinson - 28 May 2007 04:55 GMT
>I understand it but my calculated fields depends on fields of other tables.
>I need to run a query may have a SUM(..) in the SELECT part.

You can use the builtin DSum() function, or create a stored query and use
DLookUp to retrieve a value from that query. You don't say anything about the
nature of the calculation so I really can't be much help other than that!

            John W. Vinson [MVP]
 
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.