UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Help with Dlookup in VBA    
 
   
tbonehwd
post Mar 17 2006, 11:39 AM
Post #1

UtterAccess Member
Posts: 32



I had this working just fine in Access query designer and I am trying to us it in VBA and keep getting a complile error. I think it has to do with the double quotes but I am not sure what to do. I simply changed the view in the query designer to sql view to get this code any suggestions?


CODE
sqlSTR="SELECT Spring2006.ITM_NUM, CDSITM_M.ITM_DSC1, DLookUp("[CMP_NME]","CDSADR_M","[CTM_NBR]='000000604974' and [ADR_CDE]='STANDARD' and [ADR_FLG]='0'" ) As Company " & _
", IIf(IsNull([UNITS_ORD]),0,[UNITS_ORD]) AS Ordered " & _
"FROM (Spring2006 LEFT JOIN qryAMWHOLE ON Spring2006.ITM_NUM = qryAMWHOLE.ITM_NUM) INNER JOIN CDSITM_M ON Spring2006.ITM_NUM = CDSITM_M.ITM_NUM " & _
"ORDER BY Spring2006.ITM_NUM;"
Go to the top of the page
 
+
jinky44
post Mar 17 2006, 12:14 PM
Post #2

UtterAccess VIP
Posts: 2,128
From: San Jose, California



Untested, but I suspect the dlookup clause should be:

DLookUp(""[CMP_NME]"", ""CDSADR_M"",""[CTM_NBR]='000000604974' and [ADR_CDE]='STANDARD' and [ADR_FLG]='0'"" )

???

Jinky
Go to the top of the page
 
+
tbonehwd
post Mar 17 2006, 01:33 PM
Post #3

UtterAccess Member
Posts: 32



Thank you that did it... Thanks for your help!
Go to the top of the page
 
+
jinky44
post Mar 17 2006, 02:16 PM
Post #4

UtterAccess VIP
Posts: 2,128
From: San Jose, California



You are very welcome. Glad to have been of assistance.

And thanks for the feedback. It's always nice to know how things turned out.

Jinky.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th June 2013 - 06:54 AM