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
[...] Repeat for 4 others fields
But when it come to :
txtYear = DLookup("YearItem", "tblDescItem", "FKCodeItem =[ItemID] ")
If (Not IsNull(txtYear)) Then Me![Year] = txtYear
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.
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