Results 1 to 3 of 3
  1. #1
    fmartz is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Posts
    2

    Need Help With DLookUp Function in Access 2010

    How can I put an IFF statment after [PSI_RTS] <=84 to subtract -2 days and if > 84 than subtract -3 days, 84 being the primary key.
    Private Sub Text195_Click()



    Text195 = DLookup("[BLDCED_Cur]", "TAB_LM6000", "[PSI_RTS]=forms![frmMaster_addLM6000]![PSI_RTS]-2")

    End Sub

    Text195-Main Assy ST [BLDCST_Cur] is the event code to subtract 2 days.
    Text189-Main Assy End [BLDCED_Cur]
    TAB_LM6000 - Table
    [frmMaster_addLM6000]-Form
    [PSI_RTS]-Text271 primary Key 84

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Why are you using the Click event of a textbox to set its value?

    Variables must be concatenated into an expression. Reference to control is a variable.

    Text195 = DLookup("[BLDCED_Cur]", "TAB_LM6000", "[PSI_RTS]=" & Forms![frmMaster_addLM6000]![PSI_RTS] & IIF(Forms![frmMaster_addLM6000]![PSI_RTS]>84,-3,-2))
    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.

  3. #3
    fmartz is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Posts
    2
    Thank you so much, that worked great.

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

Similar Threads

  1. Replies: 10
    Last Post: 08-29-2012, 06:45 AM
  2. Creating Browse function in Access 2010
    By martindenise in forum Access
    Replies: 3
    Last Post: 08-09-2012, 05:44 PM
  3. DLOOKUP function
    By tariq1 in forum Programming
    Replies: 5
    Last Post: 07-17-2012, 04:22 PM
  4. Access 2010 function
    By abm1961 in forum Access
    Replies: 5
    Last Post: 07-21-2011, 12:15 PM
  5. Need Help for Dlookup function
    By wasim_sono in forum Programming
    Replies: 5
    Last Post: 01-04-2006, 08:18 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