PDA

View Full Version : [SOLVED:] Dlookup function not working.



samuelimtech
09-03-2014, 03:26 AM
Hi all,

im trying to return a single value from a table and assign it to
a string to be used later but Dlookup isnt working at all. below is the code im
using and the error message im recieving is "wrong number of arguements or
invalid property assignment"



Code:
Sub boo()
Dim result As Integer
result = dlookup("Definition", "Config", "Parameter = 'Mail Folder'")
End Sub
thanks
p.s i have an
earlier post trying to solve the same problem via SQL, I will close both when
one is answered. thanks .

ranman256
09-03-2014, 06:28 AM
It should work if:
Definition is the field name
Config is the table/query
parameter is the field name
and the result will always be integer

It could fail if the reply does not exist, then the result is NULL and you cant set integers to null.
dim the result as variant