'Tag' property of combo box

D

Dorian

Can I store the date/time the combo box entry was selected in the tag
property and read this value later. E.g.
Me!cmbBox.tag = Now()
Is there any reason why this would not work?
In the form before update event, I need to know the exact time when the
combo box was last changed.

-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
D

Dirk Goldgar

Dorian said:
Can I store the date/time the combo box entry was selected in the tag
property and read this value later. E.g.
Me!cmbBox.tag = Now()
Is there any reason why this would not work?
In the form before update event, I need to know the exact time when the
combo box was last changed.


I don't see why it would not work, so long as you're talking about doing
this within the same editing session (between opening and closing the form).
Bear in mind that the Tag property is a text property, so you'll probably
need to convert it back to the Date data type (using the CDate() function,
probably) for comparisons with Now().

Would you need to be sure to clear the Tag property in the form's Current
event, to make sure it's fresh for each new record?

It seems to me you could, alternatively, also use a module-level variable or
a hidden text box on the form for this purpose.

I'm curious. What is the need behind this request? I've never encountered
a similar question.
 
D

Dorian

This is a ticketing system and the combo box represents the team to whom the
ticket is assigned. This form also allows the ticket to be emailed out to the
team.
The user wants an 'email reminder' when a ticket agent forgets to email the
team the ticket. So I need to capture when the last email was sent and
compare it to when the assigned team was changed to determine if the email
was sent before or after the team was changed. If it was not sent after then
this triggers the email alert (in the Form before update event).
 
B

boblarson

This would only be good for one combo box (not PER RECORD). So that combo
would have the last change regardless of which record your users had done.
That doesn't seem right to me based on your description of what you are
looking for. I would use an additional field in the table to store that
information for THAT record.
 
D

Dirk Goldgar

Dorian said:
This is a ticketing system and the combo box represents the team to whom
the
ticket is assigned. This form also allows the ticket to be emailed out to
the
team.
The user wants an 'email reminder' when a ticket agent forgets to email
the
team the ticket. So I need to capture when the last email was sent and
compare it to when the assigned team was changed to determine if the email
was sent before or after the team was changed. If it was not sent after
then
this triggers the email alert (in the Form before update event).


I'm probably not imagining this very well. What happens if the the user
selects the wrong value in the combo box, then attempts to correct it but
selects another wrong value, then finally selects the right value? Does
that scenario break anything?

If the only thing that matters is what team is selected when the record is
saved (form BeforeUpdate or AfterUpdate event), then wouldn't it make sense
to record the sending of the e-mail, including the date/time and to whom it
was sent, and then just check in the form AfterUpdate event to see if an
e-mail has been sent? Maybe then, if an e-mail has already been sent to a
different team, you would then automatically send a cancellation e-mail to
that team as well as an assignment e-mail to the new team.

I suspect I'm missing something.
 
D

Dorian

I only need this for one combo box and the value is not stored - it's just
neeeded for comparison with another date/time in the form BeforeUpdate event.
The tag will be initialized in the form current event.

-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
D

Dorian

I don't think wrong combo box selections will matter. The tag date/time will
only be set if the value <> oldvalue and so long as the final selection is
right, the date/time will be recorded.
The date/time the assignment is done is critical to compare with when the
last email was sent. The application does not store to whom the last email
was sent - that might be a good idea though.
This is one change I thought was going to be simple but has opened several
cans of worms.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
D

Dirk Goldgar

Dorian said:
I don't think wrong combo box selections will matter. The tag date/time
will
only be set if the value <> oldvalue and so long as the final selection is
right, the date/time will be recorded.
The date/time the assignment is done is critical to compare with when the
last email was sent. The application does not store to whom the last email
was sent - that might be a good idea though.
This is one change I thought was going to be simple but has opened several
cans of worms.


Have you reached a resolution on this? Is it now working the way you want?
 

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