PC Review


Reply
Thread Tools Rate Thread

Add to my AfterupDate

 
 
Bob
Guest
Posts: n/a
 
      6th Nov 2006


--

How do I add this to my script:
subSetValues

If tbStableReturnDate.value = "" Or IsNull(tbStableReturnDate.value) Then
tbStableReturnDate.value = Format(Now, "dd-mmm-yy")
End If
End Sub



Thanks for any Help

.........Bob Vance


 
Reply With Quote
 
 
 
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      6th Nov 2006
I'd use it like this:

If Len(Me.tbStableReturnDate & vbNullString) = 0 Then
Me.tbStableReturnDate = Format(Date, "dd-mmm-yy")
End If

vbNullString will return 0 if tbStableReturnDate is either Null or Empty.
Only use Now if you need the time as well as the date. The value property of
a control is the default.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Bob" <(E-Mail Removed)> wrote in message news:eimccp$1ki$(E-Mail Removed)...
>
>
> --
>
> How do I add this to my script:
> subSetValues
>
> If tbStableReturnDate.value = "" Or IsNull(tbStableReturnDate.value) Then
> tbStableReturnDate.value = Format(Now, "dd-mmm-yy")
> End If
> End Sub
>
>
>
> Thanks for any Help
>
> ........Bob Vance
>



 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      6th Nov 2006
Thanks Arvin I will give it a go.....Bob

"Arvin Meyer [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'd use it like this:
>
> If Len(Me.tbStableReturnDate & vbNullString) = 0 Then
> Me.tbStableReturnDate = Format(Date, "dd-mmm-yy")
> End If
>
> vbNullString will return 0 if tbStableReturnDate is either Null or Empty.
> Only use Now if you need the time as well as the date. The value property
> of a control is the default.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
> "Bob" <(E-Mail Removed)> wrote in message news:eimccp$1ki$(E-Mail Removed)...
>>
>>
>> --
>>
>> How do I add this to my script:
>> subSetValues
>>
>> If tbStableReturnDate.value = "" Or IsNull(tbStableReturnDate.value) Then
>> tbStableReturnDate.value = Format(Now, "dd-mmm-yy")
>> End If
>> End Sub
>>
>>
>>
>> Thanks for any Help
>>
>> ........Bob Vance
>>

>
>



 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      6th Nov 2006
Arvin Its not holding the information when I quit and re open my db, funny
enough it holds the date if I manually enter it in but the Description box
with the code is not holding any information....Thanks bob
"Bob" <(E-Mail Removed)> wrote in message news:eimn28$l39$(E-Mail Removed)...
> Thanks Arvin I will give it a go.....Bob
>
> "Arvin Meyer [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I'd use it like this:
>>
>> If Len(Me.tbStableReturnDate & vbNullString) = 0 Then
>> Me.tbStableReturnDate = Format(Date, "dd-mmm-yy")
>> End If
>>
>> vbNullString will return 0 if tbStableReturnDate is either Null or Empty.
>> Only use Now if you need the time as well as the date. The value property
>> of a control is the default.
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>> "Bob" <(E-Mail Removed)> wrote in message news:eimccp$1ki$(E-Mail Removed)...
>>>
>>>
>>> --
>>>
>>> How do I add this to my script:
>>> subSetValues
>>>
>>> If tbStableReturnDate.value = "" Or IsNull(tbStableReturnDate.value)
>>> Then
>>> tbStableReturnDate.value = Format(Now, "dd-mmm-yy")
>>> End If
>>> End Sub
>>>
>>>
>>>
>>> Thanks for any Help
>>>
>>> ........Bob Vance
>>>

>>
>>

>
>



 
Reply With Quote
 
Richard Williams
Guest
Posts: n/a
 
      6th Nov 2006

"Bob" <(E-Mail Removed)> wrote in message news:eimpj7$puh$(E-Mail Removed)...
> Arvin Its not holding the information when I quit and re open my db, funny
> enough it holds the date if I manually enter it in but the Description box
> with the code is not holding any information....Thanks bob
> "Bob" <(E-Mail Removed)> wrote in message news:eimn28$l39$(E-Mail Removed)...
>> Thanks Arvin I will give it a go.....Bob
>>
>> "Arvin Meyer [MVP]" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> I'd use it like this:
>>>
>>> If Len(Me.tbStableReturnDate & vbNullString) = 0 Then
>>> Me.tbStableReturnDate = Format(Date, "dd-mmm-yy")
>>> End If
>>>
>>> vbNullString will return 0 if tbStableReturnDate is either Null or
>>> Empty. Only use Now if you need the time as well as the date. The value
>>> property of a control is the default.
>>> --
>>> Arvin Meyer, MCP, MVP
>>> http://www.datastrat.com
>>> http://www.mvps.org/access
>>> http://www.accessmvp.com
>>>

>>

>
>

This is just a guess but the title of your post implies that you are calling
the code in the After Update event of the form. I think you need to call it
in the Before Update event.


 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      6th Nov 2006

"Richard Williams" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> "Bob" <(E-Mail Removed)> wrote in message news:eimpj7$puh$(E-Mail Removed)...
>> Arvin Its not holding the information when I quit and re open my db,
>> funny enough it holds the date if I manually enter it in but the
>> Description box with the code is not holding any information....Thanks
>> bob
>> "Bob" <(E-Mail Removed)> wrote in message news:eimn28$l39$(E-Mail Removed)...
>>> Thanks Arvin I will give it a go.....Bob
>>>
>>> "Arvin Meyer [MVP]" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> I'd use it like this:
>>>>
>>>> If Len(Me.tbStableReturnDate & vbNullString) = 0 Then
>>>> Me.tbStableReturnDate = Format(Date, "dd-mmm-yy")
>>>> End If
>>>>
>>>> vbNullString will return 0 if tbStableReturnDate is either Null or
>>>> Empty. Only use Now if you need the time as well as the date. The value
>>>> property of a control is the default.
>>>> --
>>>> Arvin Meyer, MCP, MVP
>>>> http://www.datastrat.com
>>>> http://www.mvps.org/access
>>>> http://www.accessmvp.com
>>>>
>>>

>>
>>

> This is just a guess but the title of your post implies that you are
> calling the code in the After Update event of the form. I think you need
> to call it in the Before Update event.

thanks Richard that worked, but if there is already a date in date box it
will not over ride the earlier date.....Thanks bob


 
Reply With Quote
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      6th Nov 2006
Your code only adds the date if there isn't a date already in
tbStableReturnDate. If you want to add the date regardless of anything in
the textbox, forget the If ... Then statement and just use:

Private Sub Form_BeforeUpdate (Cancel As Integer)
Me.tbStableReturnDate = Format(Date, "dd-mmm-yy")
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Bob" <(E-Mail Removed)> wrote in message news:eimuud$3o7$(E-Mail Removed)...
>
> "Richard Williams" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>
>> "Bob" <(E-Mail Removed)> wrote in message news:eimpj7$puh$(E-Mail Removed)...
>>> Arvin Its not holding the information when I quit and re open my db,
>>> funny enough it holds the date if I manually enter it in but the
>>> Description box with the code is not holding any information....Thanks
>>> bob
>>> "Bob" <(E-Mail Removed)> wrote in message news:eimn28$l39$(E-Mail Removed)...
>>>> Thanks Arvin I will give it a go.....Bob
>>>>
>>>> "Arvin Meyer [MVP]" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> I'd use it like this:
>>>>>
>>>>> If Len(Me.tbStableReturnDate & vbNullString) = 0 Then
>>>>> Me.tbStableReturnDate = Format(Date, "dd-mmm-yy")
>>>>> End If
>>>>>
>>>>> vbNullString will return 0 if tbStableReturnDate is either Null or
>>>>> Empty. Only use Now if you need the time as well as the date. The
>>>>> value property of a control is the default.
>>>>> --
>>>>> Arvin Meyer, MCP, MVP
>>>>> http://www.datastrat.com
>>>>> http://www.mvps.org/access
>>>>> http://www.accessmvp.com
>>>>>
>>>>
>>>
>>>

>> This is just a guess but the title of your post implies that you are
>> calling the code in the After Update event of the form. I think you need
>> to call it in the Before Update event.

> thanks Richard that worked, but if there is already a date in date box it
> will not over ride the earlier date.....Thanks bob
>



 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      6th Nov 2006
Thanks Arvin, that did the trick ...........Regards Bob

"Arvin Meyer [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Your code only adds the date if there isn't a date already in
> tbStableReturnDate. If you want to add the date regardless of anything in
> the textbox, forget the If ... Then statement and just use:
>
> Private Sub Form_BeforeUpdate (Cancel As Integer)
> Me.tbStableReturnDate = Format(Date, "dd-mmm-yy")
> End Sub
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
> "Bob" <(E-Mail Removed)> wrote in message news:eimuud$3o7$(E-Mail Removed)...
>>
>> "Richard Williams" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>>
>>> "Bob" <(E-Mail Removed)> wrote in message news:eimpj7$puh$(E-Mail Removed)...
>>>> Arvin Its not holding the information when I quit and re open my db,
>>>> funny enough it holds the date if I manually enter it in but the
>>>> Description box with the code is not holding any information....Thanks
>>>> bob
>>>> "Bob" <(E-Mail Removed)> wrote in message news:eimn28$l39$(E-Mail Removed)...
>>>>> Thanks Arvin I will give it a go.....Bob
>>>>>
>>>>> "Arvin Meyer [MVP]" <(E-Mail Removed)> wrote in message
>>>>> news:(E-Mail Removed)...
>>>>>> I'd use it like this:
>>>>>>
>>>>>> If Len(Me.tbStableReturnDate & vbNullString) = 0 Then
>>>>>> Me.tbStableReturnDate = Format(Date, "dd-mmm-yy")
>>>>>> End If
>>>>>>
>>>>>> vbNullString will return 0 if tbStableReturnDate is either Null or
>>>>>> Empty. Only use Now if you need the time as well as the date. The
>>>>>> value property of a control is the default.
>>>>>> --
>>>>>> Arvin Meyer, MCP, MVP
>>>>>> http://www.datastrat.com
>>>>>> http://www.mvps.org/access
>>>>>> http://www.accessmvp.com
>>>>>>
>>>>>
>>>>
>>>>
>>> This is just a guess but the title of your post implies that you are
>>> calling the code in the After Update event of the form. I think you need
>>> to call it in the Before Update event.

>> thanks Richard that worked, but if there is already a date in date box it
>> will not over ride the earlier date.....Thanks bob
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: AfterUpdate help Douglas J. Steele Microsoft Access Forms 1 27th Mar 2009 11:05 AM
AfterUpdate? John Keith Microsoft Access Form Coding 1 14th Apr 2008 03:48 PM
Afterupdate when and how toine@xs4all.nl Microsoft Access Forms 4 22nd Oct 2005 03:09 PM
AfterUpdate =?Utf-8?B?TGVBbm4=?= Microsoft Access Forms 1 17th Jun 2005 04:30 AM
Afterupdate Charlie Microsoft Access Form Coding 1 22nd Aug 2003 08:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:03 AM.