Results 1 to 5 of 5

Insert data when form field is left lank

  1. #1
    Daccess is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2019
    Posts
    7

    Insert data when form field is left lank

    my form requires first and last name but nick name is optional. I want to fill the nick name with first name wherever it is left blank. Iím not sure how to set up an event for this.

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,350
    I would start with trying the form BeforeUpdate event. That way, if the field is bound, you can make the nick name field the same as what the first name field is. Seems like a very odd thing though.
    - "doesn't work" is no help. Post err msgs and where.
    - Use code tags for code/sql. Implement changes in copies of your database.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,268
    Code:

    Me!NickName = Nz(Me!NickName, Me!FirstName)

    Alternative is to just calculate in query or textbox on report:

    =Nz([NickName],[FirstName])
    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.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    14,308
    Or, if no nick name is supplied, use the FirstName where ever you need to use Nickname--no need to store it twice.

    Logic,
    use Nickname if available, or use FirstName if Nickname is empty.

  5. #5
    Daccess is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2019
    Posts
    7
    That works- thanks

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

Similar Threads

  1. Replies: 7
    Last Post: 09-13-2017, 10:44 AM
  2. Replies: 7
    Last Post: 07-24-2017, 11:47 PM
  3. Replies: 1
    Last Post: 12-28-2016, 11:39 AM
  4. Replies: 1
    Last Post: 04-24-2014, 06:31 AM
  5. Replies: 3
    Last Post: 09-13-2011, 07:58 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
  •  
Tech Forums: Microsoft Office Forums