Wierd.....

All of the table exist.  All of the fields exist.  When I write the 
query to a file, then paste it in a query window, it runs.  But when 
I have it in code I get method open of object _recordest failed to 
open.

Can anybody explain this?


sql2 = "select po.po_id,sum(pd.pd_rsizetot) as sum_size,pd.pd_id2,sum
(pd.pd_price) as sum price " & _
      "  from root_po_detail pd,root_po po,root_category 
ca,promise_week pw " & _
      "  where po.po_id = pd.pd_serial " & _
      "  and pd.pd_rec_date > pw.end " & _
      "  and pw.po_id = po.po_id " & _
      "  and pd.pd_rec_date > po.po_promise " & _
      "  and ca.ca_id = pd.pd_id2 "
sql2 = sql2 & IIf(Trim(POs) <> "", " and po.po_id in(" & POs 
& " ", "")
sql2 = sql2 & IIf(Trim(Classes) <> "", " and pd.pd_id2 in(" & Classes 
& ") ", "")
sql2 = sql2 & IIf(Trim(Depts) <> "", " and ca.ca_otb in(" & Depts 
& ") ", "")
sql2 = sql2 & " and pd.pd_rec_date between cdate('" & CStr
((Form_Main.Calendar1.Value)) & "') and cdate('" & CStr
((Form_Main.calendar2.Value)) & "') group by po.po_id,pd.pd_id2 "

MsgBox sql2
Open "c:\po.sql" For Output As #1
Print #1, sql2
Close





------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12h2q9g28/M=362329.6886308.7839368.1510227/D=groups/S=1705115370:TM/Y=YAHOO/EXP=1124333155/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~-> 


Please zip all files prior to uploading to Files section. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AccessDevelopers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to