Results 1 to 6 of 6

Thread: Update

  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I have the following code in the AfterUpdate event of a field (IWO), and also in the OnEnter event of the field that that is next in tab order (HTCylcle).

    Dim varIWO, varMaterial, varPartNo As Variant
    Dim Cancel As Integer
    varMelt = (DLookup("[Alloy_Melt_No2]", "[tblDetails]", "[IWO_No] = [Batch]"))
    varMaterial = (DLookup("[Descline1]", "[Material]", "[Partcode] = [Part No]"))
    varPartNo = (DLookup("[PART NO]", "[tblDetails]", "[IWO_No] = [Batch]"))
    varDesc = (DLookup("[Descline1]", "[Stock1]", "[Code]= [Part No]"))



    If (Not IsNull(varMelt)) Then
    Me.MELT_No = varMelt
    Me.MATERIAL = varMaterial
    Me.PART_NO = varPartNo
    Me.DESCRIPTION = varDesc

    After entering the IWO and pressing enter, only the Part No appears. If I then double click into the HTCycle control on the form, the rest of the data then appears. Shouldn't if appear once I press enter?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='robm' post='769686' date='08-Apr-2009 14:25'][/quote]
    Yes, it should appear once you press enter.
    Can you attach a stripped and zipped version of you db ?
    Francois

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    [quote name='robm' post='769686' date='09-Apr-2009 00:25']I have the following code in the AfterUpdate event of a field (IWO), and also in the OnEnter event of the field that that is next in tab order (HTCylcle).

    Dim varIWO, varMaterial, varPartNo As Variant
    Dim Cancel As Integer
    varMelt = (DLookup("[Alloy_Melt_No2]", "[tblDetails]", "[IWO_No] = [Batch]"))
    varMaterial = (DLookup("[Descline1]", "[Material]", "[Partcode] = [Part No]"))
    varPartNo = (DLookup("[PART NO]", "[tblDetails]", "[IWO_No] = [Batch]"))
    varDesc = (DLookup("[Descline1]", "[Stock1]", "[Code]= [Part No]"))



    If (Not IsNull(varMelt)) Then
    Me.MELT_No = varMelt
    Me.MATERIAL = varMaterial
    Me.PART_NO = varPartNo
    Me.DESCRIPTION = varDesc

    After entering the IWO and pressing enter, only the Part No appears. If I then double click into the HTCycle control on the form, the rest of the data then appears. Shouldn't if appear once I press enter?[/quote]
    Have you determined that the values varMelt etc have values in the code above at the time of execution?

    By the way you don't need round brackets around the DLookup function.

  4. #4
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks both. I will strip the database down as a last resort, but it's rather large, and contains customer data. Patt, how do I test that data is being pulled in?

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    [quote name='robm' post='769851' date='09-Apr-2009 12:18']how do I test that data is being pulled in?[/quote]
    You can set a breakpoint on the line

    varMelt = ...

    by clicking anywhere in the line and pressing F9.

    When the code is run, it will pause at the breakpoint. You can single-step through it by pressing F8.
    You can see the value of a variable by hovering the mouse pointer over its name in the code.

    Press F5 to resume uninterrupted execution.

  6. #6
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks Hans. I'll look into whats happening.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •