Results 1 to 3 of 3
  1. #1
    dccjr3927 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    130

    DCount to Determine Record

    Good Afternoon All:



    I have what I hope is a quick question concerning using DCount to determine if a record exists. I have the following

    Code:
    If DCount("*", "[Inventory]", "[SKU] = " & Me.tbxProductSKU) > 0 Then
        strUpdateQtySQL = "UPDATE Inventory SET Quantity = Quantity -" & Me.tbxSKUQty & " WHERE SKU  = " & Me.tbxProductSKU & ";"
    End If
    but am getting a Data Type Mismatch error on the DCount line.

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    If the sku is a string, you must put quotes around it....
    ...,"[sku]='" & me.txtBox & "'")

  3. #3
    dccjr3927 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    130
    I always forget the single quote for strings. Thanks.

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

Similar Threads

  1. Determine row number in sub form
    By odb2012 in forum Forms
    Replies: 6
    Last Post: 11-08-2018, 07:31 AM
  2. Replies: 3
    Last Post: 01-08-2018, 09:02 AM
  3. How to determine if a record is the first in its set
    By ExtremeNovice in forum Queries
    Replies: 2
    Last Post: 03-03-2017, 03:18 PM
  4. Replies: 3
    Last Post: 05-13-2012, 07:31 AM
  5. How to determine if textbox contains a value then
    By shabbaranks in forum Programming
    Replies: 1
    Last Post: 02-01-2012, 10:58 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