Results 1 to 3 of 3
  1. #1
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89

    Update Iff?


    Greetings, I have a spreadsheet that has been imported into access and is missing information in certain columns, ex. col 1 row 56 is missing the amount and col 15 row 68 is missing dates, I have set it up to append new records and now I need to find a way to set it up to where if the value is null or has changed, I need that field to update ...


    v/r
    novice

  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,625
    Update with what from where? From the linked Excel to the Access table? Build a query the joins the objects on common unique ID field, switch to UPDATE query, set the UpdateTo row to field(s) from the Excel.

    Or if you don't want to affect existing data (although, does it matter?), try:

    Nz([Access table fieldname], [Excel link fieldname])
    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
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Access will read Excel and sometimes guess about the data type. It thinks the column is a number but somewhere there will be text so it gets confused and turns it NULL.
    To prevent this on these certain fields, i run a macro in Excel that scans the column and hardcodes it to a text value.

    Code:
      'it assumes there is a value in every row of the 1st column
    Public Sub Cvt2Txt()
    Dim iOff As Long
    iOff = ActiveCell.Column - 1
    While ActiveCell.Offset(0, -iOff).Text <> ""
       If ActiveCell.Value <> "" Then
          If Left(ActiveCell.Value, 1) <> "'" Then ActiveCell.Value = "'" & ActiveCell.Value
       End If
       ActiveCell.Offset(1, 0).Select  'next row
    Wend
    End Sub

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

Similar Threads

  1. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  2. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  3. Replies: 4
    Last Post: 11-10-2011, 03:41 PM
  4. Replies: 1
    Last Post: 08-19-2011, 12:16 PM
  5. Replies: 1
    Last Post: 01-22-2011, 12:23 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