Results 1 to 3 of 3
  1. #1
    virgilio is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    81

    DLOOKUP returns integer for value stored as number with decimal places

    Hi,



    I am trying to use DLOOKUP to pull a value from a table with decimal places. This code works but the decimal places are dropped, and VarType() shows that it is pulling that value as a Long Integer (type 3). How can I force it to keep the decimal places?

    Code:
       tempMat = Me.MaterialName.Value ' this is selected from a drop down
       decimalValue = DLookup("[HALF_LIFE_HOURS]", "MATERIAL_TABLE", "MATERIAL_DESCRIPTION = '" & tempMat & "'")
       
       MsgBox (VarType(decimalValue))

  2. #2
    Minty is online now VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    What did you declare DecimalValue as ?
    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 ↓↓

  3. #3
    virgilio is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    81
    Quote Originally Posted by Minty View Post
    What did you declare DecimalValue as ?

    Thank you, that was it. I declared it as a Long, I changed it to double and it works now.

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

Similar Threads

  1. Replies: 10
    Last Post: 03-15-2020, 01:46 AM
  2. Changing Decimal Places
    By Kiran Prakash in forum Reports
    Replies: 2
    Last Post: 02-02-2019, 01:47 AM
  3. Replies: 2
    Last Post: 10-21-2013, 01:23 PM
  4. Decimal Places
    By momodoujimnjie in forum Access
    Replies: 1
    Last Post: 01-09-2013, 04:49 AM
  5. Replies: 0
    Last Post: 01-30-2012, 01:20 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