If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Formula Help in a calculated text field
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 -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200804/1 |
#2
|
|||
|
|||
Formula Help in a calculated text field
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. -- Dave Hargis, Microsoft Access MVP "Lori2836 via AccessMonster.com" wrote: 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 -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200804/1 |
#3
|
|||
|
|||
Formula Help in a calculated text field
Thanks Klatuu! I appreciate your help. If it doesn't work for some reason,
I'll let you know. Have a great weekend. Lori Klatuu wrote: 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. 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 -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200804/1 |
#4
|
|||
|
|||
Formula Help in a calculated text field
Please do,
You, too. Mine starts in 15 minutes. Be Back Monday -- Dave Hargis, Microsoft Access MVP "Lori2836 via AccessMonster.com" wrote: Thanks Klatuu! I appreciate your help. If it doesn't work for some reason, I'll let you know. Have a great weekend. Lori Klatuu wrote: 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. 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 -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200804/1 |
#5
|
|||
|
|||
Formula Help in a calculated text field
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 Klatuu wrote: Please do, You, too. Mine starts in 15 minutes. Be Back Monday 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 -- Message posted via http://www.accessmonster.com |
#6
|
|||
|
|||
Formula Help in a calculated text field
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. -- Dave Hargis, Microsoft Access MVP "Lori2836 via AccessMonster.com" wrote: 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 Klatuu wrote: Please do, You, too. Mine starts in 15 minutes. Be Back Monday 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 -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|