3xGuy
3xGuy

Reputation: 2559

VBA Basic Function returning null

I have a very basic function that is to return symbols such as "=", ">","<",">=", and "<=" and it is only returning a null value. any Ideas?

Function Lookup_Symbol(search_Name As String) As String
    Lookup_Symobl = DLookup("[Symbol]", "[Search_Names]", "[Search_Name]= '" & search_Name & "'")
End Function

when I do a Debug.print DLookup("[Symbol]", "[Search_Names]", "[Search_Name]= '" & search_Name & "'") it will return =

Upvotes: 0

Views: 80

Answers (1)

Mark Butler
Mark Butler

Reputation: 895

Because you have misspelled Lookup_Symbol in your function. It should be:

Function Lookup_Symbol(search_Name As String) As String
    Lookup_Symbol = DLookup("[Symbol]", "[Search_Names]", "[Search_Name]= '" & search_Name & "'")
End Function

You would have been able to spot this much easier if you had Option Explicit at the top of the module; it would then have told you that the variable Lookup_Symobl is not defined.

Upvotes: 1

Related Questions