Date stamp on exit

S

Somecallmejosh

I posted the following message in the Macro section of
this forum and haven't received a response. Hopefully,
this is the correct place to post a message of this type.
__________________________________________________________
Hello,

I have a form containing the following field names:
[KitReturned]
[PostedDate]

I would like to set up a Macro, if possible, that fills
the current date in the [PostedDate] field after exiting,
or entering a date into the [KitReturned] field. I tried
the SetValue approach but was met with much resistance.
Does anyone have any ideas on how I can accomplish this?
Thanks in advance.

Josh
 
R

Rob Oldfield

Macros are not the way to go. They're only there (bar a couple of uses) to
provide backward compatibility with earlier versions of Access. You're
better off doing it with code. I don't get exactly what you mean by
'exiting' in your post... whether that's the KitReturned control, or the
entire form... but for the other part of your requirement you're going to be
best off using the afterupdate event of KitReturned. Something like...

private sub kitreturned_afterupdate()
if isdate(me.kitreturned) then
me.posteddate=date
endif
end sub

That's obviously not going to completely solve your problem. Let me know
what else you need it to do.
 
S

Somecallmejosh

Thank you for your response...
OK, here's the situation. I've got a tabbed form that has
one of the fields (the [Kit Returned] field) on one tabbed
page (page is called "Receiving Testing")and the other
field ([PostedDate]) on a different tabbed page (this
tabbed page is called "Client Info/Shipping"). These
pages are in the same form, called "Samplog".

The [Kit Returned] field is a date field. After entering
the date in this field, I would like the current date (a
date stamp - to show the date that information was posted
into the [Kit Returned] field, not the same date that was
entered in the [Kit Returned] field) to appear in the
[DatePosted] field.

I understand that this will require VBA but my knowledge
of the subject is extremely limited. Please be gentle.
Thanks in advance for offering your support.

Josh


-----Original Message-----
Macros are not the way to go. They're only there (bar a couple of uses) to
provide backward compatibility with earlier versions of Access. You're
better off doing it with code. I don't get exactly what you mean by
'exiting' in your post... whether that's the KitReturned control, or the
entire form... but for the other part of your requirement you're going to be
best off using the afterupdate event of KitReturned. Something like...

private sub kitreturned_afterupdate()
if isdate(me.kitreturned) then
me.posteddate=date
endif
end sub

That's obviously not going to completely solve your problem. Let me know
what else you need it to do.


I posted the following message in the Macro section of
this forum and haven't received a response. Hopefully,
this is the correct place to post a message of this type.
__________________________________________________________
Hello,

I have a form containing the following field names:
[KitReturned]
[PostedDate]

I would like to set up a Macro, if possible, that fills
the current date in the [PostedDate] field after exiting,
or entering a date into the [KitReturned] field. I tried
the SetValue approach but was met with much resistance.
Does anyone have any ideas on how I can accomplish this?
Thanks in advance.

Josh


.
 
R

Rob Oldfield

In that case my original code should work. To set it up select the Kit
Returned field in the design of your form and then view its properties. On
the Event tab click in to the after update event and then hit the button
with 3 dots on the right. Then choose Code Builder and you'll be taken to
the basic outline of the subroutine. You can then just add this into the
middle of it...

if isdate(me.kitreturned) then
me.posteddate=date
endif

If you type that out then after you type the two me. bits, then Access'
intellisense should kick in so that you see a list of all the available
items that me. can refer to (me. basically just picks out things from the
current form)

So all that that is doing is to check that the text entered into kitreturned
is a date.. and if it is then put today's date (given by the date function)
into the PostedDate field.

The fact that the two controls are on different tabs of a tabbed control
makes no difference. It's only when you start referring to controls on
subforms that you have to start worrying about that.


Somecallmejosh said:
Thank you for your response...
OK, here's the situation. I've got a tabbed form that has
one of the fields (the [Kit Returned] field) on one tabbed
page (page is called "Receiving Testing")and the other
field ([PostedDate]) on a different tabbed page (this
tabbed page is called "Client Info/Shipping"). These
pages are in the same form, called "Samplog".

The [Kit Returned] field is a date field. After entering
the date in this field, I would like the current date (a
date stamp - to show the date that information was posted
into the [Kit Returned] field, not the same date that was
entered in the [Kit Returned] field) to appear in the
[DatePosted] field.

I understand that this will require VBA but my knowledge
of the subject is extremely limited. Please be gentle.
Thanks in advance for offering your support.

Josh


-----Original Message-----
Macros are not the way to go. They're only there (bar a couple of uses) to
provide backward compatibility with earlier versions of Access. You're
better off doing it with code. I don't get exactly what you mean by
'exiting' in your post... whether that's the KitReturned control, or the
entire form... but for the other part of your requirement you're going to be
best off using the afterupdate event of KitReturned. Something like...

private sub kitreturned_afterupdate()
if isdate(me.kitreturned) then
me.posteddate=date
endif
end sub

That's obviously not going to completely solve your problem. Let me know
what else you need it to do.


I posted the following message in the Macro section of
this forum and haven't received a response. Hopefully,
this is the correct place to post a message of this type.
__________________________________________________________
Hello,

I have a form containing the following field names:
[KitReturned]
[PostedDate]

I would like to set up a Macro, if possible, that fills
the current date in the [PostedDate] field after exiting,
or entering a date into the [KitReturned] field. I tried
the SetValue approach but was met with much resistance.
Does anyone have any ideas on how I can accomplish this?
Thanks in advance.

Josh


.
 
S

Somecallmejosh

Rob,

Thanks a million. I will follow through with your advice
and post a comment upon completion. Thank God for this
forum.

Josh
-----Original Message-----
In that case my original code should work. To set it up select the Kit
Returned field in the design of your form and then view its properties. On
the Event tab click in to the after update event and then hit the button
with 3 dots on the right. Then choose Code Builder and you'll be taken to
the basic outline of the subroutine. You can then just add this into the
middle of it...

if isdate(me.kitreturned) then
me.posteddate=date
endif

If you type that out then after you type the two me. bits, then Access'
intellisense should kick in so that you see a list of all the available
items that me. can refer to (me. basically just picks out things from the
current form)

So all that that is doing is to check that the text entered into kitreturned
is a date.. and if it is then put today's date (given by the date function)
into the PostedDate field.

The fact that the two controls are on different tabs of a tabbed control
makes no difference. It's only when you start referring to controls on
subforms that you have to start worrying about that.


Thank you for your response...
OK, here's the situation. I've got a tabbed form that has
one of the fields (the [Kit Returned] field) on one tabbed
page (page is called "Receiving Testing")and the other
field ([PostedDate]) on a different tabbed page (this
tabbed page is called "Client Info/Shipping"). These
pages are in the same form, called "Samplog".

The [Kit Returned] field is a date field. After entering
the date in this field, I would like the current date (a
date stamp - to show the date that information was posted
into the [Kit Returned] field, not the same date that was
entered in the [Kit Returned] field) to appear in the
[DatePosted] field.

I understand that this will require VBA but my knowledge
of the subject is extremely limited. Please be gentle.
Thanks in advance for offering your support.

Josh


-----Original Message-----
Macros are not the way to go. They're only there (bar
a
couple of uses) to
provide backward compatibility with earlier versions of Access. You're
better off doing it with code. I don't get exactly
what
you mean by
'exiting' in your post... whether that's the
KitReturned
control, or the
entire form... but for the other part of your
requirement
you're going to be
best off using the afterupdate event of KitReturned. Something like...

private sub kitreturned_afterupdate()
if isdate(me.kitreturned) then
me.posteddate=date
endif
end sub

That's obviously not going to completely solve your problem. Let me know
what else you need it to do.


I posted the following message in the Macro section of
this forum and haven't received a response. Hopefully,
this is the correct place to post a message of this type.
__________________________________________________________
Hello,

I have a form containing the following field names:
[KitReturned]
[PostedDate]

I would like to set up a Macro, if possible, that fills
the current date in the [PostedDate] field after exiting,
or entering a date into the [KitReturned] field. I tried
the SetValue approach but was met with much resistance.
Does anyone have any ideas on how I can accomplish this?
Thanks in advance.

Josh



.


.
 

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