Hello,
I have two queries that contain a CUISP (similar to a ticker, like for a stock) and the number of holders. My two queries get their data from two different databases. I need a way to add these together. I wrote a function using Dlookup, but I won't always have the same CUSIPS in each table. If I don't, DLookup returns a null value and it won't let me proceed. How can I make this work? Here is the code:
GetNumberOfHolders = (DLookup("CountOfAccount_ID", "qryCount400Accounts", "CUSIP_ID = '" & CUSIP & "'")) + (DLookup("CountOfAccount_ID", "qryCount300Accounts", "CUSIP_ID = '" & CUSIP & "'"))
Can someone suggest a way to do this?
Thanks!
I have two queries that contain a CUISP (similar to a ticker, like for a stock) and the number of holders. My two queries get their data from two different databases. I need a way to add these together. I wrote a function using Dlookup, but I won't always have the same CUSIPS in each table. If I don't, DLookup returns a null value and it won't let me proceed. How can I make this work? Here is the code:
GetNumberOfHolders = (DLookup("CountOfAccount_ID", "qryCount400Accounts", "CUSIP_ID = '" & CUSIP & "'")) + (DLookup("CountOfAccount_ID", "qryCount300Accounts", "CUSIP_ID = '" & CUSIP & "'"))
Can someone suggest a way to do this?
Thanks!