Auto Populate a Field on a Form based on Certain Criteria

G

Guest

Hey everyone,

I'm building a database to track customer interactions. I have a form bound
to one main table that contains all of my data (no lookup tables needed.) On
the form, I'm trying to make it so that whenever a user changes the "Status"
control/field drop down to "Pending" the "Pend Date" control/field will
auto-populate with the current date - otherwise if the status field isn't
changed or is changed to something else like closed, it remains null.

Both of these fields are stored on the same table.

I'm not the best VB coder, and the coding and Q&A's I've seen on many forums
including this one address simpler look-up and linked-table auto population
questions (or blanket, "how do I auto-populate the form with today's date"
questions.) I know there is an easy solution, but my attempts aren't
working. Any help???

Thanks,
Jake
 
T

tina

simple code running in the Status control's AfterUpdate event procedure
should do it, as

If Me!Status = "Pending" Then
Me!PendDate = Date
Else
Me!PendDate = Null
End If

if your controls are not actually named "Status" and "PendDate", then
substitute the correct names, of course.

hth
 

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