PC Review


Reply
Thread Tools Rate Thread

Command Button Query

 
 
Bob
Guest
Posts: n/a
 
      13th Dec 2006


--

I have a command button that enters Todays date, is it possible to add to
the code that If I click it again and their is a date in the text box it
will delete it then if I click it again and it is Blank it will enter
today's date
thanks for any help...............Bob

Private Sub Command440_Click()
tbBox9Date.value = Format(Now(), "dd-mmm-yy")

End Sub





..........Jenny Vance


 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGFuaWVs?=
Guest
Posts: n/a
 
      13th Dec 2006
Bob,

Try the following:

Private Sub Command440_Click()
If isnull(me.tbBox9Date) then
Me.tbBox9Date.value = Format(Date(), "dd-mmm-yy")
Else
Me.tbBox9Date=Null
End if
End Sub

You should also try to give appropriate names to your controls (trust me it
will get ugly if you don't) and don't forget to add some error handling.

Daniel







"Bob" wrote:

>
>
> --
>
> I have a command button that enters Todays date, is it possible to add to
> the code that If I click it again and their is a date in the text box it
> will delete it then if I click it again and it is Blank it will enter
> today's date
> thanks for any help...............Bob
>
> Private Sub Command440_Click()
> tbBox9Date.value = Format(Now(), "dd-mmm-yy")
>
> End Sub
>
>
>
>
>
> ..........Jenny Vance
>
>
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      13th Dec 2006
Private Sub Command440_Click()
If Len(Me.tbBox9Date & vbNullString) > 0 Then
Me.tbBox9Date = Null
Else
Me.tbBox9Date = Format(Now(), "dd-mmm-yy")
End If
End Sub


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Bob" <(E-Mail Removed)> wrote in message news:elno61$43p$(E-Mail Removed)...
>
>
> --
>
> I have a command button that enters Todays date, is it possible to add to
> the code that If I click it again and their is a date in the text box it
> will delete it then if I click it again and it is Blank it will enter
> today's date
> thanks for any help...............Bob
>
> Private Sub Command440_Click()
> tbBox9Date.value = Format(Now(), "dd-mmm-yy")
>
> End Sub
>
>
>
>
>
> .........Jenny Vance
>



 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      13th Dec 2006
Thanks Douglas worked Perfectly ............Bob

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:(E-Mail Removed)...
> Private Sub Command440_Click()
> If Len(Me.tbBox9Date & vbNullString) > 0 Then
> Me.tbBox9Date = Null
> Else
> Me.tbBox9Date = Format(Now(), "dd-mmm-yy")
> End If
> End Sub
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Bob" <(E-Mail Removed)> wrote in message news:elno61$43p$(E-Mail Removed)...
>>
>>
>> --
>>
>> I have a command button that enters Todays date, is it possible to add to
>> the code that If I click it again and their is a date in the text box it
>> will delete it then if I click it again and it is Blank it will enter
>> today's date
>> thanks for any help...............Bob
>>
>> Private Sub Command440_Click()
>> tbBox9Date.value = Format(Now(), "dd-mmm-yy")
>>
>> End Sub
>>
>>
>>
>>
>>
>> .........Jenny Vance
>>

>
>



 
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
Opening a query from a command button paul bennett Microsoft Access Form Coding 2 4th May 2010 05:39 PM
Query Command Button Problem Shari Microsoft Access Queries 3 5th Feb 2008 08:30 PM
Query/command button Cyp Microsoft Access 4 23rd Apr 2004 08:26 PM
Command Button Query Neil Microsoft Powerpoint 3 26th Mar 2004 09:17 PM
Command Button error with query TC Microsoft Access Form Coding 2 17th Nov 2003 02:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:48 PM.