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 / New Users / May 2008

Tip: Looking for answers? Try searching our database.

Update a form with a Command Button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alimbilo - 12 May 2008 17:28 GMT
How can I have a Command Button to execute all the code I wrote in a form?
Ken Sheridan - 12 May 2008 17:43 GMT
Two ways:

1.  Put the code in the button's Click event procedure.

2.  Put the code in a Private function in the form's Module, or a Public
function in a standard module if you want to use the same code elsewhere in
the database.  Then call the function from the button's properties sheet as
the On Click event property of the button:

=YourFunctionName()

Ken Sheridan
Stafford, England

> How can I have a Command Button to execute all the code I wrote in a form?
Alimbilo - 12 May 2008 17:49 GMT
Thanks,

My other question is how can I have a field to show me the exact number.
What I meant is, I am trying to divide 400 / 104 and the field is giving me
4.00 as an answer but I want it to show me 3.85

Thanks

> Two ways:
>
[quoted text clipped - 11 lines]
>
> > How can I have a Command Button to execute all the code I wrote in a form?
Ken Sheridan - 12 May 2008 18:16 GMT
If the result is shown in an unbound control on then you need to set the
Format property of the control to show however many decimal places you want
to show.  The following would format the control to show two decimal places
and to use a comma as the separator for values of one thousand or more:

#,##0.00

If the control is bound to a field in the underlying table then the field
should be defined in the table design as a single or double precision
floating point number data type, not an integer (by default number fields are
long integers).  However, if the calculated value can always be derived from
other fields in the table then it should not be stored in a field at all.  
That constitutes redundancy and leaves the table open to the risk of
inconsistent data being entered.  The value can always be obtained by means
of a computed unbound control in a form or report, or by a computed column in
a query.

Ken Sheridan
Stafford,  England

> Thanks,
>
[quoted text clipped - 19 lines]
> >
> > > How can I have a Command Button to execute all the code I wrote in a form?
 
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



©2008 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.