Check textbox value before change

M

moosecck

I have a form called Edit Application which is used to pull a record
from the tblCreditApplicationInput table and display the record for
Editing. One field is called Date Rcvd, which was created when the
application is created. Another field is called status which uses a
combo box to pull 4 values-Draft, IN Process, Approved, Declined. My
client wants me to have the Date Rcvd value change to the current date
if the Status value is Draft and is changed to any of the other 3
values. How do I get the system to look at the Status value in the
Status textbox before it processes the date change? Ex: If Status =
Draft and it is changed to any other value, change Date Rcvd to
current date, If Status is any of the other 3 values and changes to
any of the other values leave the date as is. This one is baffling
me. Any ideas would be greatly appreciated.

Thanks

Tom
 
D

Dirk Goldgar

I have a form called Edit Application which is used to pull a record
from the tblCreditApplicationInput table and display the record for
Editing. One field is called Date Rcvd, which was created when the
application is created. Another field is called status which uses a
combo box to pull 4 values-Draft, IN Process, Approved, Declined. My
client wants me to have the Date Rcvd value change to the current date
if the Status value is Draft and is changed to any of the other 3
values. How do I get the system to look at the Status value in the
Status textbox before it processes the date change? Ex: If Status =
Draft and it is changed to any other value, change Date Rcvd to
current date, If Status is any of the other 3 values and changes to
any of the other values leave the date as is. This one is baffling
me. Any ideas would be greatly appreciated.

Thanks

Tom


If this is a bound form, then the Status control will have an OldValue
property that holds its value before it was changed. Therefore, you can use
the control's AfterUpdate event to check what just happened and change the
date. For example,

'----- start of example code -----
Private Sub Status_AfterUpdate()

With Me!Status
If .Value <> "Draft" Then
If .OldValue = "Draft" Then
Me![Date Recvd] = Date
End If
End If
End With

End Sub
'----- end of example code -----
 

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