Results 1 to 2 of 2
  1. #1
    annarene is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2008
    Posts
    3

    How to deal with nulls, empty strings in Update Query

    Hello: I have an update query on my page and it's complaining when I try to pass values...I think they're null, but they could be empty strings too.

    here's my sql:

    Code:
     
    sSQL = "UPDATE tblStates SET Color1 = '" & DataGridView1.Item("C1", j).Value.ToString() & ",Brightness1 = '" & DataGridView1.Item("B1", j).Value.ToString() & "' ,Flash1 = '" & DataGridView1.Item("F1", j).Value.ToString() & "'," _
    & " Color2 = '" & DataGridView1.Item("C2", j).Value.ToString() & "',Brightness2 = '" & DataGridView1.Item("B2", j).Value.ToString() & "' ,Flash2 = '" & DataGridView1.Item("F2", j).Value.ToString() & "'," _
    & " Color3 = '" & DataGridView1.Item("C3", j).Value.ToString() & "',Brightness3 = '" & DataGridView1.Item("B3", j).Value.ToString() & "' ,Flash3 = '" & DataGridView1.Item("F3", j).Value.ToString() & "'," _
    & " Color4 = '" & DataGridView1.Item("C4", j).Value.ToString() & "',Brightness4 = '" & DataGridView1.Item("B4", j).Value.ToString() & "' ,Flash4 = '" & DataGridView1.Item("F4", j).Value.ToString() & "'" _
    & " WHERE StateId = " & sStateId
    
    I was wondering how ...in access, to deal with this....? In oracle, there's an nvl function that replaces the null with what ever you want. Is there something similar for access sql? Or rather, do I need to use some type of expression...Iff statement in my update statement?

    any dirrection is truly appreciated.
    Thanks,
    annarene




  2. #2
    jya is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2007
    Location
    Chicagoland
    Posts
    109
    Have you tried Nz?

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

Similar Threads

  1. Update Query
    By Najeeb in forum Queries
    Replies: 1
    Last Post: 11-19-2015, 04:02 AM
  2. Update Query
    By GrnISSO in forum Queries
    Replies: 0
    Last Post: 06-15-2007, 05:41 PM
  3. Need help with an Update query ...
    By valkyry in forum Queries
    Replies: 0
    Last Post: 04-23-2007, 08:45 PM
  4. Strings limited to 255 characters
    By ocordero in forum Programming
    Replies: 4
    Last Post: 08-09-2006, 09:13 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