Can I calculate from unbound text boxes?

R

Rachael

In Access 2007, I want to create a form to calculate an age as of a certain
date (insurance effective date).

My form will have three fields: DOB, EffDate and IssueAge.

Can this be done using an unbound form with unbound text controls for the
DOB and EffDate (user enters these values), then use an expression in the
IssueAge field to calculate the age based on the eff date and DOB

OR

Must a table be used to store the DOB and Effdate values so that the
expression has a stored value to refer to in making the calculation?

I would prefer to be able to do this without creating a table that will
store values that are otherwise useless. Can you help?

Thanks,
Rachael
 
L

Linq Adams via AccessMonster.com

Private Sub DOB_AfterUpdate()
If Not IsNull(Me.EffDate) Then
Me.IssueAge = DateDiff("yyyy", [DOB], EffDate) - IIf(Format$(EffDate,
"mmdd") < Format$([DOB], "mmdd"), 1, 0)
End If
End Sub

Private Sub EffDate_AfterUpdate()
If Not IsNull(Me.DOB) Then
Me.IssueAge = DateDiff("yyyy", [DOB], EffDate) - IIf(Format$(EffDate,
"mmdd") < Format$([DOB], "mmdd"), 1, 0)
End If
End Sub

How are you planning to store the IssueAge if everything is unbound?
 
R

Rachael

That was actually my question - whether or not it could be done. I have no
problem creating a table (and have already done so), binding the form fields
to the appropriate fields in the table. This entire process is for
calculating and verification purposes only, not to store anything anywhere. I
suppose I can simply empty the table periodically, since the data is
irrelevant once the verification is made.

Thanks for your help.

Rachael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top