Results 1 to 3 of 3
  1. #1
    goldfrapp01 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2013
    Posts
    3

    value changes from 1 to -1 when imported from SQL server

    Hi everybody,

    I have a vba code that builds a SQL String, opens a connection to SQL server and imports the contents of a SQL View into an Access table.

    Everything works fine, except one column "primary_account" where I store 1 and 0 for True and False. In Access 1 shows up as -1. Does anyone know the cause of this and how can I fix it? Thanks!
    Click image for larger version. 

Name:	SQL.PNG 
Views:	11 
Size:	4.7 KB 
ID:	12379




    Click image for larger version. 

Name:	access.PNG 
Views:	11 
Size:	3.5 KB 
ID:	12380

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I have seen different programs/languages treat Boolean's differently, using 1 and 0 or -1 and 0. Usually and easy way to handle either case is to just used the following criteria for calculations or criteria:
    Code:
    True: <> 0
    False: =0
    or you could just use True and False.

    If this does not solve your issue, please explain exactly what it is that needs fixing (a calculation? query? report?).

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Even within Microsoft, there are different values for TRUE between Access and Excel.

    Excel : False = 0, True = 1

    Access : False = 0, True = -1


    So you can say: FALSE = 0 and TRUE = any number except 0 (positive or negative)

    I tend to use False and Not False in code.

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

Similar Threads

  1. Replies: 0
    Last Post: 12-20-2012, 01:44 PM
  2. Imported data has different ID
    By cheyanne in forum Forms
    Replies: 48
    Last Post: 05-28-2012, 09:47 AM
  3. Report How many records were imported
    By AlexisW in forum Programming
    Replies: 3
    Last Post: 05-24-2012, 11:08 AM
  4. Imported Named Range
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 03-04-2011, 10:03 AM
  5. Help with imported data
    By bubbasheeko in forum Queries
    Replies: 0
    Last Post: 01-12-2007, 07:12 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