Results 1 to 3 of 3

Thread: DLookup problem

  1. #1
    Join Date
    Aug 2003
    Montreal, Québec

    Unanswered: DLookup problem

    Hi, i really need help with that....

    when i put a "ItemID" on a TextBox, On ItemID_Exit

    txtModel = DLookup("ModelItem", "tblDescItem", "FKCodeItem =[ItemID] ")
    If (Not IsNull(txtModel)) Then Me![model] = txtModel
    End If
    [...] Repeat for 4 others fields

    But when it come to :

    txtYear = DLookup("YearItem", "tblDescItem", "FKCodeItem =[ItemID] ")
    If (Not IsNull(txtYear)) Then Me![Year] = txtYear
    End If

    The DLookup method return: "" instead of Null
    I dont know why, it's the same syntax, table, reference, it cauz me a lot of trouble...
    Any solution ?



    WHOA !! something really weird happen...

    In my variable declaration :
    Dim txtModel, txtLitre, txtVin, txtDesc, txtYear As String
    The txtYear Dlookup was buggin'

    but if i switch to
    Dim txtModel, txtYear, txtLitre, txtVin, txtDesc As String
    It's now the txtDesc DLookup who's bug

    What happen there !?
    The last variable in the declaration is treated in a different way?

    I'm really confused !
    i need explanation, i think...


    I understand now !!
    I'm too familar with Java, C++ and so on...

    If you want all your variable take the type of a string you have to set all separately.
    Exemple :

    Dim MyString1, MyString2 as String
    Just the last one(MyString2) will be a String... The first one will be variant... if you want all as string you have to put "As String" to each of them
    Dim MyString1 As String, MyString2 As String...

    Now I can formally say that I dislike VBA!!!! Afflicted for all my stupid post... I am new with access... and the manner of coding is really strange

    Last edited by Gigs; 09-25-03 at 10:00.

  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland
    ooops. didn't see you had answered your own question.
    Last edited by izyrider; 09-25-03 at 10:05.

  3. #3
    Join Date
    Aug 2003
    Montreal, Québec
    Originally posted by izyrider
    ooops. didn't see you had answered your own question.
    Yeah !
    I often answers my own questions...
    I would owe post less often :P
    I have often problems to understand the "operation/functionning" of access...

    But Thank to answer me, it's really appreciate


    (really sorry for my English faults)

Posting Permissions

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