"Issues" database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to create a new field named "Completion Date" in the Issues Table and
have it be set by default to the current date when an issue is closed. How
do I do that?
 
I want to create a new field named "Completion Date" in the Issues Table and
have it be set by default to the current date when an issue is closed. How
do I do that?

If you're updating the table using a Form (as you should be!), you can
use the AfterUpdate event of whichever control "closes" an issue. Put
a textbox (it needn't be visible) on the Form bound to the Completion
Date field and use code like

Private Sub controlname_AfterUpdate()
If Me!controlname = "Closed" Then
Me!txtCompletionDate = Date
End If
End Sub

John W. Vinson[MVP]
 
Assuming that there is a Form you use to input other data - then this new
field would then also be added to the Form.

In design view of the Form - select this new controlbox, right click to
properties, and then in the row named 'Default Value' you will put in:

=Date()

save and return to Form....you should see current date now appear in this box
 
John Vinson said:
If you're updating the table using a Form (as you should be!), you can
use the AfterUpdate event of whichever control "closes" an issue. Put
a textbox (it needn't be visible) on the Form bound to the Completion
Date field and use code like

Private Sub controlname_AfterUpdate()
If Me!controlname = "Closed" Then
Me!txtCompletionDate = Date
End If
End Sub

John W. Vinson[MVP]

John,

I can actually understand what that code is saying but how come you don't
have to use this Date() to have access understand you want today's date?

Thanks,
Linda
 
I can actually understand what that code is saying but how come you don't
have to use this Date() to have access understand you want today's date?

You do in a Query; it doesn't need (and in fact will automatically
remove) the parentheses in VBA code.

John W. Vinson[MVP]
 
Assuming that there is a Form you use to input other data - then this new
field would then also be added to the Form.

In design view of the Form - select this new controlbox, right click to
properties, and then in the row named 'Default Value' you will put in:

=Date()

save and return to Form....you should see current date now appear in this box

Note that this will put in the date that the record was initially
created - which might or might not be the date that the issue was
Closed.

John W. Vinson[MVP]
 
John Vinson said:
You do in a Query; it doesn't need (and in fact will automatically
remove) the parentheses in VBA code.

John W. Vinson[MVP]

Good Grief! See, I'll never be able to type my own code even if I sort of
can read it. Although, I just cancatenated a few fields in a query all by
myself and remembered the []&" without looking it up.........Linda
 
Thanks Good folks,

I'll give this a try tomorrow and let you know how it came out.

LMB said:
John Vinson said:
You do in a Query; it doesn't need (and in fact will automatically
remove) the parentheses in VBA code.

John W. Vinson[MVP]

Good Grief! See, I'll never be able to type my own code even if I sort of
can read it. Although, I just cancatenated a few fields in a query all by
myself and remembered the []&" without looking it up.........Linda
 

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

Back
Top