Results 1 to 2 of 2
  1. #1
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    add to recordset error when no value

    Good morning all! I am trying to update a recordset with the values chosen from a list box, it works slick, UNTIL Access runs across a null value in one of the columns, I'm trying to handle it with an IIF statement right now, to no avail, and I've tried using the NZ function with no luck.
    Code:
    rst!price = IIf([Forms]![Orders]![BuildItFloor].[Form]!LSTBUILDABLE.Column(5) > 0, [Forms]![Orders]![BuildItFloor].[Form]!LSTBUILDABLE.Column(5), 0)
    How can I handle this? Thank you in advance!

  2. #2
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,144
    Is the listbox on the form your code is on ?
    Try setting the value into a variable first

    Code:
    Dim iValue as Long
    
    iValue = Nz(Me.Lstbuildtable.Column(5),0)
    rst!price = iValue
    Alternatively if you build the list box row source from a query , use a Nz() in that to ensure there aren't any null values.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

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

Similar Threads

  1. Recordset Failed Error
    By RayMilhon in forum Programming
    Replies: 9
    Last Post: 04-10-2017, 09:03 PM
  2. syntax error on Recordset
    By jtm013 in forum Programming
    Replies: 1
    Last Post: 07-09-2015, 02:17 PM
  3. Recordset Open Error
    By RayMilhon in forum Programming
    Replies: 4
    Last Post: 08-27-2013, 05:54 PM
  4. Recordset Error
    By gazzieh in forum Programming
    Replies: 3
    Last Post: 02-17-2012, 05:13 PM
  5. Syntax Error Help with Recordset
    By ajetrumpet in forum Programming
    Replies: 11
    Last Post: 09-08-2010, 02:39 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