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 / April 2008

Tip: Looking for answers? Try searching our database.

Formula Help in a calculated text field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lori2836 - 18 Apr 2008 16:11 GMT
Good morning.    I'm trying to figure out how to write a formula for a
calculated text field called Cost:

If Hrs is blank, allow a manual entry, otherwise if Date Initiated is <
#4/1/2007#, then Hrs*94.45/1000 else Hrs*99.55/1000

and since I'm not too good at this stuff, I wonder if someone could help?

Thanks!
Lori
Klatuu - 18 Apr 2008 19:06 GMT
Since you want to allow manual entry in the text box, you can't use the
control source property because this is, I think, a bound control.  So I
think the best thing to do would be to use the form's Current event to
populate the control based on whether Hrs has a value.

   If Not IsNull(Me.Hrs) Then
       If Me.Date < #4/1/2007# Then
           Me.CalcControl = Hrs*94.45/1000
       Else
           Me.CalcControl = Hrs*99.55/1000
       End If
   End IF

Also, change the name of the control to something other than Date.  Date is
a reserved word and using it as a name can cause problems.
And, forms don't have fields. They have controls.  Only tables and queries
have fields.
Signature

Dave Hargis, Microsoft Access MVP

> Good morning.    I'm trying to figure out how to write a formula for a
> calculated text field called Cost:
[quoted text clipped - 6 lines]
> Thanks!
> Lori
Lori2836 - 18 Apr 2008 20:08 GMT
Thanks Klatuu!   I appreciate your help.  If it doesn't work for some reason,
I'll let you know.  Have a great weekend.

Lori

>Since you want to allow manual entry in the text box, you can't use the
>control source property because this is, I think, a bound control.  So I
[quoted text clipped - 18 lines]
>> Thanks!
>> Lori
Klatuu - 18 Apr 2008 20:17 GMT
Please do,
You, too.
Mine starts in 15 minutes.  Be Back Monday
Signature

Dave Hargis, Microsoft Access MVP

> Thanks Klatuu!   I appreciate your help.  If it doesn't work for some reason,
> I'll let you know.  Have a great weekend.
[quoted text clipped - 23 lines]
> >> Thanks!
> >> Lori
Lori2836 - 21 Apr 2008 15:07 GMT
Happy Monday Klatuu.  I have tried your suggestion, but for some reason it
isn't working.  When you say "current event", exactly what are you talking
about?   I have tried to add it in several different areas as an event and I
think I may be putting it in the wrong place.

Thank you!
Lori

>Please do,
>You, too.
[quoted text clipped - 4 lines]
>> >> Thanks!
>> >> Lori
Klatuu - 21 Apr 2008 15:14 GMT
Open your form in design view.
Open the properties dialog and be sure it says Form in the box at the top
Select the Events tab
Click on the small button with the 3 dots just to the right of the On
Current box.
Select Code Builder
Put the code in there.
Signature

Dave Hargis, Microsoft Access MVP

> Happy Monday Klatuu.  I have tried your suggestion, but for some reason it
> isn't working.  When you say "current event", exactly what are you talking
[quoted text clipped - 12 lines]
> >> >> Thanks!
> >> >> Lori
 
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.