Results 1 to 5 of 5
  1. #1
    ronnie is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2013
    Posts
    2

    Error Joining text strings with no value

    I've created a text box to join text strings from 6 possible functions, but if any of them are left blank I receive an error. I was able to enter the following code to get the first function to work if blank (Blank Function is code " " to leave space blank)



    =IIf(IsNull([TS Function1]), [BlankFunction], [TS Function1].Text)

    How do I apply this to the following code to join all strings strings?

    =([TS Function1]& ", "&[TS Function2]& ", " &[TS Function3]& ", " &[TS Function4]& ", "&[TS Function5]& ", "&[TS Function6])

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,942
    What do you mean joining functions? Those look like field names.

    Why call a function or reference a field just to concatenate a space? There is a limit to number of characters allowed in a ControlSource expression.

    Maybe you should call another function to assemble the 6 possible functions.
    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
    ronnie is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2013
    Posts
    2
    Yes, my "functions" are fields that I'd like to join, but if any of them are blank I receive an error.
    [BlankFunction] directs to a field with an entry" ", but if I enter this into the code as " " it does not work.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,942
    Don't understand, concatenate a space same as concatenating any character. Or is your [BlankFunction] field really an empty string or Null?

    What is the error?

    A series of IIf's in the ControlSource expression can construct the string but it will be a long expression. Probably should build a custom function to accomplish.
    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
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I'm confused as to exactly what you're trying to do, here, but the function usually employed to deal with Null ('blank') Fields is Nz(). For the example you gave it would be

    =Nz([TS Function1], " ")

    BTW, in Access, you can only refer the Text Property when the Control in question actually has the Focus, which is why it is seldom used.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Comparing Strings
    By Paul H in forum Programming
    Replies: 1
    Last Post: 01-27-2012, 01:46 PM
  2. Cocatenation of strings
    By swetha in forum Access
    Replies: 1
    Last Post: 09-21-2011, 08:31 AM
  3. Delete Specific Text Strings in a Field
    By JET in forum Queries
    Replies: 5
    Last Post: 08-25-2011, 03:33 PM
  4. Replies: 2
    Last Post: 05-19-2011, 04:07 PM
  5. joining text in text boxes
    By jjwilliams73 in forum Forms
    Replies: 1
    Last Post: 08-26-2008, 02:30 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