Results 1 to 10 of 10
  1. #1
    bino is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2025
    Posts
    4

    Appending records from an imported table

    Hi all

    I have a table that has imported data. Here is what I want to do:

    I have



    Field a 'Home'
    Field b ' '
    Field c ' '

    I only need the field that has a content to be appended to a unique field G

    the programming would be

    If field a is not blank, G = field a, else if field b is not blank, G = field b, else if field c is not blank, G = field c. In this case field G would be 'Home'

    Trying to figure out how to do that using query option.

    thanks

    bino

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    G=nz(a,nz(b,c)

    assumes by ‘blank’ you mean null and not a zls or space

  3. #3
    bino is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2025
    Posts
    4
    Quote Originally Posted by CJ_London View Post
    G=nz(a,nz(b,c)

    assumes by ‘blank’ you mean null and not a zls or space
    Thanks CJ

    I fail to see where that would be inserted in the query screen.

    Thanks

    Bino

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    you haven't provided table names or proper field names but in the query grid you would put the calculation in the field row and 'G' in the append to row

    And you haven't clarified whether fields a, b and c could be null, zls or a space since 'blank' is an excel term completely irrelevant to a database such as access. Unlike excel, the data type and value matter as to how the calculation is constructed

  5. #5
    jojowhite's Avatar
    jojowhite is offline Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    430
    you write an Update query and update your table after appending the data:

    Code:
    Update YourTableName Set [G] = Switch(Len([A] & "") > 0, [A], Len([B] & "") > 0, [B], Len([C] & "") > 0, [C], True, "Home")
    Last edited by jojowhite; 07-24-2025 at 05:17 AM.

  6. #6
    bino is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2025
    Posts
    4
    Quote Originally Posted by CJ_London View Post
    you haven't provided table names or proper field names but in the query grid you would put the calculation in the field row and 'G' in the append to row

    And you haven't clarified whether fields a, b and c could be null, zls or a space since 'blank' is an excel term completely irrelevant to a database such as access. Unlike excel, the data type and value matter as to how the calculation is constructed
    Hi CJ

    Trying to add print screens of the query, but forum not accepting it. How can I send you the print screens?

  7. #7
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    How can I send you the print screens?
    To do so, click on the Go Advanced tab, scroll down and click on the Manage Attachments button>Add files>choose, then upload
    Attached Thumbnails Attached Thumbnails image_2025-07-24_122528125.png  

  8. #8
    bino is offline Novice
    Windows 10 Office 365
    Join Date
    Jul 2025
    Posts
    4

    print screen

    Here it is

    Click image for larger version. 

Name:	Example of the query with names.jpg 
Views:	12 
Size:	146.2 KB 
ID:	53158

  9. #9
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    So what don’t you understand? From the code provided replace a,b, c and G with your field names

    Be aware that having spaces and none alpha numeric characters in field names can cause issues

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    Show the SQL please.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. When importing table, not all records imported
    By ceatana in forum Import/Export Data
    Replies: 1
    Last Post: 05-23-2018, 01:32 PM
  2. Appending inventory records with current price records
    By sberti in forum Database Design
    Replies: 8
    Last Post: 11-29-2012, 10:24 PM
  3. Replies: 1
    Last Post: 06-19-2012, 06:12 PM
  4. Appending records to other records
    By AVHer in forum Access
    Replies: 6
    Last Post: 07-28-2011, 11:57 AM
  5. show duplicate records when appending a table
    By bdaniel in forum Programming
    Replies: 1
    Last Post: 06-01-2011, 07:15 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