Link to home
Start Free TrialLog in
Avatar of Patrick O'Dea
Patrick O'DeaFlag for Ireland

asked on

My Dlookup is returning a string (I want a number)

See
Expr1: DLookUp("(AllowanceAMount)","tblAllowances","AllowanceID=1")

This returns the correct value BUT as a string...

I want [AllowanceAmount] returned as a number (which is how it is held on tblAllowances).

What should I do?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Patrick O'Dea

ASKER

Thank Rey,

I just learnt something!
If you are using this DLookup() in a query, then you should change your method to use an outer join (left) to tblAllowances instead.  This will return the data you want with far less overhead and will not change the data type.

the DLookup() runs a SEPARATE query for EVERY row you select.  So, if you select 100 rows, you are running 101 queries.  If you select a thousand rows, you are running 1,001 queries.

NEVER, use domain functions in queries (or code loops) unless there is no alternative and except in rare cases, there is always an alternative.
Thanks Pat,
Your words of caution are appreciated ....
I will re-engineer the query (without the Dlookup)

Many thanks once again.