Results 1 to 13 of 13
  1. #1
    aftfm is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Posts
    22

    How Add Text in field if case the field is empty

    Hi




    How to Make an empty field schedule database ACCESS default text in case the field is empty

    Default text like 12345

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Could use the DefaultValue property. When record is initiated during data entry, the field will already have this value and users can change if they choose.

    Or for a report, can calculate the alternate value in query or textbox. Use Nz().

    Nz([fieldname], "something here")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    aftfm is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Posts
    22
    What is the meaning Nz
    I Started
    Nz([LastStampDate];"1234567890")

    But he did delete the empty record puts text 1234567890

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    My example shows a comma, not semi-colon.

    You did not ask to delete record.

    You asked how to show a default value if field is null. Nz() function serves that purpose.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    aftfm is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Posts
    22
    Yse I asked how to show a default value if field is null. Nz() function serves that purpose.

    But he has deleted the entire record of the table

    I Write Nz([LastStampDate];"1234567890")

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Who is 'he'?

    I don't understand the issue. If record is deleted then it's deleted, I can't do anything about that.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    aftfm is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Posts
    22


    Ok Thanks

    This does not prevent, I have benefited from you

  8. #8
    aftfm is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Posts
    22
    I want her as well in the case of an empty field in the first picture

    Like the second picture
    Attached Thumbnails Attached Thumbnails First.png   Next.png  

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If you want to actually save the value to new record, options are:

    1. set DefaultValue property

    2. use code to save the value

    If you need to populate this field for already existing records, then run an UPDATE action.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    aftfm is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Posts
    22
    Is it possible to provide me with this code

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Which code - option 2?

    Code in some event behind form, perhaps form BeforeUpdate:

    If IsNull(Me!LastStampDate) Then Me!LastStampDate = "1234567890"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    aftfm is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Posts
    22
    Well that's where the code bearing

    If IsNull(Me!LastStampDate) Then Me!LastStampDate = "1234567890"

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Don't understand that response.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Case for in case field corrupt
    By Ruegen in forum Forms
    Replies: 9
    Last Post: 08-03-2014, 07:56 PM
  2. Replies: 12
    Last Post: 06-04-2012, 10:55 AM
  3. Select Case using query field
    By focosi in forum Programming
    Replies: 4
    Last Post: 08-15-2011, 11:00 AM
  4. Is there a way to force a field do be upper case?
    By newtoAccess in forum Access
    Replies: 1
    Last Post: 11-28-2010, 04:20 PM
  5. Replies: 2
    Last Post: 05-05-2010, 02:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums