Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    REALYOLDMAN is offline Novice
    Windows 8 Access 2016
    Join Date
    Feb 2019
    Location
    CA
    Posts
    11
    Thank you Ajax and ssanfu
    RkT in the RealOldDb is ML a string 20 in all-- field 1
    pct is a number 20 in all-- field 2
    MyDomain a string(table) CsDL or CsDH 8 in all with just ML
    so RkT pct in table CsDL is always 20 lookups
    ml 90
    a 65
    b 0
    c 0
    etc
    I changed the dim statments AND IT WORKS IN RealOldDb
    Private Sub btnELookupTest_Click()
    Dim RkT As String '<<-- holds a value for the field RKT
    Dim TblL As String '<<-- holds a value for the table/query name




    TblL = Me.MyTable '<<-- table name from form
    RkT = Me.RKTValue '<<-- tRKT Value from form
    TblL COULD BE 8*8 64 DIFFERENT TABLES
    Me.theResult = ELookup("PCT", TblL, "RKT = '" & RkT & "'")


    End Sub


    sub C()'8 MORE SUBS SO IF SUB M() CsDL CHANGES TO MsDL
    If Tdis < 8 Then
    Select Case Tsuf
    Case "T"
    TblH = "CsTh"
    TblL = "CsTL"
    Case "D"
    TblH = "CsDh"
    TblL = "CsDL" ' I changed TblL from a Dim to a public statment so sub 2 can use it
    TblL should now be "CsDL" BUT!!!!
    Me.theResult = ELookup("PCT", TblL, "RKT = '" & RkT & "'")


    still has BtRef error and that has been the problem all along


    call sub 2
    end sub
    I hope its not still a "blue thingy" but its all I got
    I would Elookup see TblL as a string "CsDL"
    thank you both

  2. #17
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    no idea what your application is supposed to do but 64 tables sound like your table/relationship design is wrong. And sorry, still 'bluey'. Your table, field, function and variable names are meaningless (to us), you reference variables and don't appear to declare them so we don't know what type they are, you pepper your code with comments and frequently your code is incomplete. And although you probably not been told to use them yet, please use the code tags (#) to highlight your code and retain indentation - e.g.

    Code:
    sub C() ' 8 MORE SUBS SO IF SUB M() CsDL CHANGES TO MsDL
     
    If Tdis < 8 Then
     
        Select Case Tsuf
           Case "T"
              TblH = "CsTh"
              TblL = "CsTL"
           Case "D"
              TblH = "CsDh"
              TblL = "CsDL" ' I changed TblL from a Dim to a public statment so sub 2 can use it
              TblL should now be "CsDL" BUT!!!!
              Me.theResult = ELookup("PCT", TblL, "RKT = '" & RkT & "'")
    
    
             still has BtRef error and that has been the problem all along
    
    
        call sub 2
     
    
    end sub
    I've highlighted your comments in red and this code is incomplete - there is no End Case so it is not clear at all where you are calling Elookup, and 'call sub 2' will not work

    In your 'old db you have

    Code:
    Dim RkT As String  '<<-- holds a value for the field RKT
        Dim TblL As String  '<<-- holds a value for the table/query name
    
    
        TblL = Me.MyTable   '<<-- table name from form
        RkT = Me.RKTValue      '<<-- tRKT Value  from form
     TblL COULD BE 8*8  64 DIFFERENT TABLES
        Me.theResult = ELookup("PCT", TblL, "RKT = '" & RkT & "'")
    in your C function you are using RkT, but I don't see it declared or assigned anywhere

  3. #18
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The dB I posted was just to demonstrate how ELookup() works.

    And I have to agree with Ajax. You are giving us a lot of code with no reference as to what it should do or any context.

    Can you describe what the process is supposed to accomplish?

    Or you could post your dB here for analysis.

  4. #19
    REALYOLDMAN is offline Novice
    Windows 8 Access 2016
    Join Date
    Feb 2019
    Location
    CA
    Posts
    11
    as I said in my last post
    "I would Elookup see TblL as a string "CsDL" "
    what you fine coders did for me is solve the DLookup works fine
    Mr Brown said DLookup would do the same as ELookup
    my TblL is made up from T type of event C distance of event s surface D odds L/H = CsDL
    all the tables have 2 fields with 20 entry's col 1 is the RkT (ml etc) witch then refer to the pct of that relates to the ML.
    I think because TblL is assigned and becomes CsDL ELookup sees a different string

    I would like ELookup see the correct table

  5. #20
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by REALYOLDMAN View Post
    as I said in my last post
    "I would Elookup see TblL as a string "CsDL" "
    I understand, but I have no idea how you are assigning a value to "TblL" (does this stand for table L??). Do you have a form?


    Quote Originally Posted by REALYOLDMAN View Post
    my TblL is made up from T type of event C distance of event s surface D odds L/H = CsDL
    This is meaningless to me because I have no idea what you are working on, what the structure of the tables are, how you are getting the values (a form?)
    Do you mean
    T = type of event
    C = distance of event
    s = surface
    D = odds
    L/H = CsDL
    ????


    Would you post your dB?

  6. #21
    REALYOLDMAN is offline Novice
    Windows 8 Access 2016
    Join Date
    Feb 2019
    Location
    CA
    Posts
    11
    Handicapping I do for fun I hope you talented coders do programing for fun also
    I do code as means to that end
    everyone who enjoys the sport has the same data
    To find the best of 10 horses who run 5280 feet an finish within inches is the goal
    The program the tech part says look at these horses
    The art part is picking the winner
    every race card has several classes Claiming Graded stakes (triple crown)G1 etc
    This is a claiming race
    It can be a Route 8 furlongs 5280 feet (r)
    a sprint (less then a mile) s
    Can be on dirt (d) or Turf(t)
    Sub Clm()
    TblL = Empty
    TblH = Empty

    If Tdis < 8 Then
    Select Case Tsuf
    Case "T"
    TblH = "CsTh"
    TblL = "CsTL"
    Case "D"
    'DoCmd.OpenQuery "CsDhq"
    TblH = "CsDh"
    TblL = "CsDL"

    End Select

    Else
    Select Case Tsuf
    Case "T"
    TblH = "CrTh"
    TblL = "CrTL"

    Case "D"
    TblH = "CrDh"
    TblL = "CrDL"
    ' Call ttPsD
    End Select
    End If
    Call filterL
    End Sub
    This little snippet took me 30 min so this is the
    reason for brevity but I love what I do

    I would like ELookup see the correct table

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 12-08-2017, 03:49 PM
  2. Replies: 4
    Last Post: 06-26-2017, 12:19 PM
  3. Replies: 12
    Last Post: 06-13-2014, 01:02 AM
  4. Error using ELookup but not DLookup
    By Rawb in forum Programming
    Replies: 12
    Last Post: 10-18-2010, 07:09 AM
  5. Replies: 3
    Last Post: 10-06-2009, 02:11 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