Results 1 to 12 of 12
  1. #1
    Join Date
    Dec 2022
    Posts
    6

    Angry Facing Problem in Dlookup() function for Datefield only

    I have create a customer data table and Dlookup that values in a form through Dlookup function all fields are copied and lookup except date. Only date field of the customer table is not working and all others fields are working properly I am using access 2007 version and widows version is 2010 and 2011. Kindly guide me about that how to input value from dlookup function in date field. Please find my coding are as below:

    Private Sub Contract_Start__Date_KeyPress(KeyAscii As Integer)


    Contract_Start_Date = DLookup("Contract_Start_Date", "Customer_Data", "Customer_ID=" & Customer_ID)
    End Sub


    Kindly look into this matter and guide me about the statement As early as possible
    Thanking You,
    Yours Faithfully
    For Nasons Associates

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Why the KeyPress event?
    See the similar threads at bottom of this page to see other responses that may apply.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,927
    As early as possible???

    It will be looked at if someone decides to take it on. Unlikely to be me with that attitude.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    What is the data type of Customer_ID. If it's text data type you have to delimit it.

    Code:
    "Customer_ID='" & Customer_ID & "'")
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    Only date field of the customer table is not working
    what does this mean? you get nothing? a wrong result? an error message?

    provide examples of the data and datatypes of what is in the customer data table and what your dlookup is returning

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Why are you even using DLookup to populate a form? Why don't you just use CustomerID to apply filter to a bound form?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Join Date
    Dec 2022
    Posts
    6
    you get nothing?

    provide examples of the data and datatypes: The Data is only Date in DD/MMMM/YY format
    of what is in the customer data table: The Consumer Detail Information is available in Customer Tata Table i.e. Name, Address Phone, Contract Date and Contract End Date etc.

  8. #8
    Join Date
    Dec 2022
    Posts
    6
    The data type of Customer_ID is Auto Number

  9. #9
    Join Date
    Dec 2022
    Posts
    6
    Why the KeyPress event?
    Because when I press the Tab Key or Enter Key it will retrieve the date value from "Customer Data" Table

  10. #10
    Join Date
    Dec 2022
    Posts
    6
    Because when I press the Tab Key or Enter Key it will retrieve the date value from "Customer Data" Table

  11. #11
    Join Date
    Dec 2022
    Posts
    6
    The Data Type is Auto Number

  12. #12
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Move it to the after update event of the customer ID.
    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. problem with shell function with Dlookup value
    By HS_1 in forum Programming
    Replies: 6
    Last Post: 02-12-2020, 05:51 PM
  2. Replies: 3
    Last Post: 02-11-2020, 02:44 PM
  3. Replies: 6
    Last Post: 03-27-2019, 12:46 AM
  4. dlookup function problem
    By bdaniel in forum Programming
    Replies: 3
    Last Post: 04-26-2010, 05:55 AM
  5. I have Problem in processing Dlookup Function
    By Katada in forum Programming
    Replies: 2
    Last Post: 04-23-2006, 12:07 AM

Tags for this Thread

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