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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating in form

Status
Not open for further replies.

kgerlitz

Technical User
Oct 2, 2004
84
0
0
US
I have created an unbound field named "RemainingDays". I want the value of this field to be the field "BMDueDate" subtracted by the current date. The code below does not give me any errors but the results for every record are "-491". What am I doing wrong? Thanks for your help

Private Sub Form_Open(Cancel As Integer)
Me.RemainingDays.Value = Me.BMDueDate.Value - Date
End Sub
 
I mistyped the formula in the last post--it actually ends with "Date ()
 
Just a thought: You could put this in the Control Source property of the Remaining Days textbox:
=DateDiff("d",[txtBMDueDate],Date())
 
How are ya kgerlitz . . .
Code:
[blue]    Me.RemainingDays = DateDiff("d", Date, Me.BMDueDate)[/blue]

Calvin.gif
See Ya! . . . . . .
 
Set the ControlSource property of RemainingDays to:
=Date()-[BMDueDate]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top