Results 1 to 5 of 5
  1. #1
    Dudley is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    3

    Constructing an address out of separate fields with conditional elements


    I am trying to make an address field out of fields for each part. I have got

    [Forms]!SecretarialForm.PSC1Address = [Forms]!PSCSubForm.Address1 & ", " & [Forms]!PSCSubForm.Address2

    If Address2 is not blank, I then need to add another ", " before adding Address3, but VBA does not seem to allow an "if then" statement at this point. Can anyone advise? Thanks. Dudley

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    =[Forms]!PSCSubForm.Address1 & ", " & iif(Not Isnull([Forms]!PSCSubForm.Address2), [Forms]!PSCSubForm.Address2 & ",",""))

  3. #3
    Dudley is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    3
    Many thanks. Dudley

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Or

    [Forms]!SecretarialForm.PSC1Address = [Forms]!PSCSubForm.Address1 & ", " & ([Forms]!PSCSubForm.Address2 + ", ")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Dudley is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    3
    Many thanks again. Dudley

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

Similar Threads

  1. How to separate names into 2-separate fields
    By djclntn in forum Queries
    Replies: 4
    Last Post: 09-18-2014, 02:34 PM
  2. Replies: 3
    Last Post: 02-07-2014, 10:37 AM
  3. How do put first and last name in separate fields.
    By rudenberg2013 in forum Access
    Replies: 9
    Last Post: 11-02-2013, 11:00 PM
  4. Replies: 2
    Last Post: 08-22-2013, 12:02 AM
  5. Replies: 6
    Last Post: 09-26-2011, 11:16 AM

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