Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2006
    Posts
    110

    Question Unanswered: code to have text inserted into field on field exit

    I'll try to explain this as best I can, I am trying to have access insert "none" into a field if it is blank. This would be done on exit of the field. How would I write this? Thanks

    Chris

  2. #2
    Join Date
    Aug 2004
    Posts
    178
    try something like

    if text6=""then

    else:text6="nothing"

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Where TestField is your text control, something like this:

    Code:
    Private Sub TestField_Exit(Cancel As Integer)
         If IsNull(Me.TestField) Or Me.TestField = "" Then
              Me.TestField = "None"
         End If
    End Sub
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Oct 2006
    Posts
    110
    Thanks for the suggestions.. I came up with:

    Private Sub TRACKING2_Exit(Cancel As Integer)
    If IsNull(Me.TRACKING2) Then
    Me.TRACKING2.Value = "NONE"
    End If



    How is this?

    It's for a field that will rarely be used, but is included in a email, so it needs a value in it.

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    That'll work, too!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    Oct 2006
    Posts
    110
    Thanks for the help!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •