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!

How to calculate a value in a form, and add it to a table??

Status
Not open for further replies.

attrofy

IS-IT--Management
Jan 10, 2002
694
US
I thought I posted this question once, but don't see it, if it shows twice, I appologize.

I am trying to have a user enter a date into a feild, then add 59 days to it to calculate a second field. I can do this without any problems, but I can't store it in a table. I have a two feilds [Issued Date] and [Expired Date]. I can set the control source to [Issued Date] + 59 and get the calculated response, but I can't pass that to the table. One other bit of trivia that may be complicating matters is the form is based on a query, taken from values of the table where I want the info stored. Due to logistics of having to "Pre-populate" certain fields, that is the reason I went this route, and it may be causing some problems. Any thoughts???
Thanks for the help.
 
I got it to work....

In the [Issued Date] After Update...
Private Sub Issued_Date_AfterUpdate()
[Expired Date] = [Issued Date] + 59
Me.Refresh
End Sub

However, now I seem to be facing a dilema, I have added a button that will generate todays date in [Issued Date], but [Expired Date] won't update. Is there an alternative to adding a similar code to the "Click" event of the button?? Since the calculation is being performed, how can I get the event to trigger the After Update code???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top