Results 1 to 2 of 2
  1. #1
    tanyalee123 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2013
    Posts
    51

    Question Help Writing an If Then Statement in a Query

    I need to write an If Then statement in a query (I think!).

    I have a field DateofService that is updated every month from a spreadsheet I import. After some changes made to the data I receive, there are instances where that field is now blank. Unfortunately, that field is a 2nd primary key in one of my tables.

    There is a 2nd date in the spreadsheet that I could use to populate that field, so what I would like to say in the update query is that if the DateofService field has data in it then populate it with that date, but if the DatofService field is empty then populate the field with the data from the ActualOtherDate field. I've tried a hundred different ways to do it, but I've never written a statement like that before so I'm coming up short somewhere.

    Thank you for any help.


    Tanya

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    In the UpdateTo line: Nz([DateofService], [ActualOtherDate])
    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.

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

Similar Threads

  1. Replies: 6
    Last Post: 02-24-2014, 09:26 AM
  2. Writing a Query!
    By dsaxena15 in forum Queries
    Replies: 1
    Last Post: 11-15-2012, 03:35 PM
  3. Help Writing VBA and call to query
    By brianb in forum Programming
    Replies: 7
    Last Post: 03-09-2011, 09:42 AM
  4. Replies: 6
    Last Post: 04-06-2010, 03:00 PM
  5. I need help writing a query statement
    By dking in forum Queries
    Replies: 1
    Last Post: 02-25-2009, 09:43 AM

Tags for this Thread

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