Results 1 to 7 of 7
  1. #1
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199

    retrieve Column Name

    abc def ghi jkl mno reason
    --------------------------------


    1 2 3 4
    3 7 9 8

    I have table in which i want to update reason column as "def missing" on 1st record and "mno missing" on second record.

    Please help, Thanks in advance.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Open the records and edit them. If you want to automate these two edits for multiple records, that would be two UPDATE queries.

    UPDATE tablename SET reason = 'def missing' WHERE def Is Null;

    UPDATE tablename SET reason = 'mno missing' WHERE mno Is Null;

    Now what do you want to do if a record has both def and mno missing?
    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
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199
    i have a excel file need to imported, which has nearly 110 Columns, after importing there are required columns which should not be empty, so i was taking them out from database in form of Excel where it needs and reason for Rejection, that so column data is missing.

    reason there are total 12 columns need to be check for such instances and the records are nearly more than 200, writing update query is ok, but if in single query i could fetch the column name then it would be nice.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Think would require VBA code.

    Can more than one column be missing data in same record?
    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
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199
    Quote Originally Posted by June7 View Post
    Think would require VBA code.

    Can more than one column be missing data in same record?
    Yes there may be but not came across yet

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    This might work:

    UPDATE tablename SET reason = Switch(IsNull([abc]), "abc missing", IsNull([def]), "def missing", IsNull([ghi]), "ghi missing", IsNull([jkl]), "jkl missing", IsNull([mno]), "mno missing");
    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
    drunkenneo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    199
    Quote Originally Posted by June7 View Post
    This might work:

    UPDATE tablename SET reason = Switch(IsNull([abc]), "abc missing", IsNull([def]), "def missing", IsNull([ghi]), "ghi missing", IsNull([jkl]), "jkl missing", IsNull([mno]), "mno missing");
    Marv.. Learned New thing Today, thanks

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

Similar Threads

  1. retrieve value from another form
    By joshynaresh in forum Forms
    Replies: 4
    Last Post: 10-27-2013, 03:39 AM
  2. how to retrieve the column name
    By rlaplume in forum Access
    Replies: 3
    Last Post: 04-09-2013, 12:41 PM
  3. ADODB Retrieve Value with SQL Help
    By kawi6rr in forum Programming
    Replies: 3
    Last Post: 05-07-2011, 02:03 PM
  4. Search and Retrieve
    By sadath in forum Access
    Replies: 3
    Last Post: 07-02-2010, 04:54 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