Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2008

Tip: Looking for answers? Try searching our database.

Checking if Text Box is empty

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tboggs25 - 30 May 2008 15:56 GMT
I have a text box that is used for notes in a form.  It is set to text with
255 characters in the table.  One of the users requested a Date Stamper (a
button to automatically put today's date in the text box).

My problem is that if there is something already in the text box, the code
that I wrote will erase the current notes and put the date in the text box.  
Now I am trying to check the text box for empty value.  If there is
information in that text box, I want the Date Stamp to just add at the end of
the last entered character.

The text box is used to make small notes, such as, I called this person, I
sent this person email, many many different variables (thats why the user
needs a text box so they are free to type what they did).  So you can imagine
why they want a date next to each action.

Here is the code that I have currently - the error is that I am improperly
using Null    

Private Sub DateStamper_Click()

   Dim tempStrg As String
   Dim outStrg As String
   Dim dateStamp As String
   Dim currentNotes As String
   
   'getting the date
   tempStrg = Now()
   'formatting the date for output
   outStrg = Left(tempStrg, 4)
   
   'adding additional format to the FINAL date output
   dateStamp = outStrg & " - "
   
   If IsNull(Me.Notes) Then
       'Text box is empty so adding the Date Stamp
       Me.Notes = dateStamp
   Else
       'getting current notes
       currentNotes = Me.Notes
       'adding Date Stamp to the end of the current notes
       Me.Notes = currentNotes & " " & dateStamp
   End If

End Sub

Any help would be greatly appreciated!!!
Leslie Isaacs - 30 May 2008 16:41 GMT
Hello

I'm not one of the experts that offers solutions in these newsgroups, but
try this:

Set the AfterUpdate event for the textbox to something like
[myTextBox].Value = [myTextBox].Value & " (" & Now() & ")"

Les

>I have a text box that is used for notes in a form.  It is set to text with
> 255 characters in the table.  One of the users requested a Date Stamper (a
[quoted text clipped - 45 lines]
>
> Any help would be greatly appreciated!!!
Michael Gramelspacher - 30 May 2008 16:47 GMT
>I have a text box that is used for notes in a form.  It is set to text with
>255 characters in the table.  One of the users requested a Date Stamper (a
[quoted text clipped - 42 lines]
>
>Any help would be greatly appreciated!!!

try this:

Me.Notes = (Me.Notes + " - ") & Left(Now(), 4)
tboggs25 - 30 May 2008 17:00 GMT
Thank you!  That was much easier than I was trying to make it.

> >I have a text box that is used for notes in a form.  It is set to text with
> >255 characters in the table.  One of the users requested a Date Stamper (a
[quoted text clipped - 46 lines]
>
> Me.Notes = (Me.Notes + " - ") & Left(Now(), 4)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.