Results 1 to 5 of 5
  1. #1
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234

    Data mismatch when importing from Excel

    I have a form online, that, when filled out, is sent to me in an Excel spreadsheet. The columns of the Excel Spreadsheet match up with the columns of a table in my DB. I plan to import the data from Excel into my DB, but several columns in the table on the DB have checkboxes, which correspond to a form(frmEmployee). The online form has the same checkboxes. However, the Excel spreadsheet does not. Instead, if the individual checked the box online, the spreadsheet indicates it with a "1".



    Can I tell the database, when it's reading that information for import, to check the corresponding box if there's a "1" in the Spreadsheet?

    Maybe something like "IIf (IsNotNull([fieldname]), yes)" or something like that?

  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
    53,770
    'fraid not - not with the import wizard. Access True is -1, anything else means False.

    Can you set a link to the spreadsheet? If so, can build a query of the linked sheet that converts the 1 to -1 and base an INSERT SELECT sql action on that.

    Otherwise, probably better clean up the spreadsheet before import.
    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
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    It'd be easy to clean the spreadsheet before import. I can just do a find and replace, and replace all "1" with -1. It'd be the only instance of a number.

    So when doing the import, if it sees -1, it'll fill in the checkbox?

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Access True is -1, anything else means False.
    In Excel, Microsoft has defined a constant TRUE as 1 and in Access, TRUE is defined as -1. In both Excel and Access the constant FALSE is defined as 0.

    In reality, FALSE = 0 and Not FALSE = TRUE.
    So that means FALSE = 0 and any other number, positive or negative, is TRUE.

    I have built forms and reports using the above to show if an option is selected/available or not.

    See attached dB...

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Okay, guess I had it backwards. In which case 1 should import as True but you say that is not happening? Or have you not tested import yet?
    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. Formstack & Importing Data via excel, best way to collect data?
    By Yogibear in forum Import/Export Data
    Replies: 2
    Last Post: 02-10-2014, 07:05 PM
  2. Replies: 9
    Last Post: 11-20-2013, 03:16 PM
  3. Replies: 1
    Last Post: 05-02-2013, 01:29 AM
  4. Importing Data from Excel
    By ineedaccesshelp in forum Import/Export Data
    Replies: 2
    Last Post: 11-28-2012, 11:02 PM
  5. Importing data from Excel
    By dsaxena15 in forum Access
    Replies: 1
    Last Post: 10-03-2012, 10:56 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