Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make a macro button perform two tasks?

Status
Not open for further replies.

Krash878

Programmer
May 8, 2001
172
US
I have a form that closes records and allows the DB to calculate a simple interest fee to be billed. My users want to bet able to use the enter key to preform the following functions.

The button right now

Private Sub Command14_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.DateClosed = Date
Me.IsClosed = 1
End Sub

Private Sub Command14_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)


Me.InterestFee = Me.IntTotal
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

End Sub

after the DateClosed the InterestFee is set. The IntTotal comes from a query that needs to have the DateClosed in it. If I put all the code in one action it does not seem to execute the Me.InterestFee = Me.IntTotal . I wonder if there is an easy way to do this. I have the users using thier mouse to execute the code now. The would like to use the Enter key.

Thanks

Kenny
 
Do you want to do this calculation every time a record is saved? If so, you should probably take all of this code and put it in the Form_BeforeUpdate event. That's the best place to do calculated fields you want to add to the record as it's saved.

I didn't understand what you're saying about an interaction between DateClosed and IntTotal. Rick Sprague
 
The formula for the int is (number of days between StartDate and ClosedDate)*(.06/365)*(Amount)= Interest Fee.

I can not get interest fee until after I have the date closed.

Kenny
 
Really, you need to be more precise with your terminology. It's hard to make out what you're saying when, for example, you refer to an event procedure as an "action". And now you say "I can not get interest fee until after I have the date closed." Well, you do have the date closed--you assigned it in the MouseDown event procedure--so what's the problem? I thought maybe you mean you need to store the date closed in the database before you can calculate the interest fee, but if that were the case, the MouseDown/MouseUp combination wouldn't be working, yet you implied that it is. Rick Sprague
 
I am sorry I do not know all the proper terminology for Access. I have not had any formal training in Access. Everything I know is self-taught and the help menu does not explain the stuff I am looking to do, at least not unless you know the proper terminology.

I can send you a copy of the database and you can see percisely what I am trying to do. Is that an option?

The form works. The problem is that the mouse must be used to perform the MouseDown/MouseUp combination. I would like to be able to press the ENTER key to make the same thing happen.

Thanks

Kenny
 
Krash,

In a keypress event,

If KeyAscii = 13 Then
Call Command14_MouseDown
Call Command14_MouseUp
End If

Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top