Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I save report from VB? 2

Status
Not open for further replies.

huichun

Programmer
Jul 24, 2002
8
US
I am trying to saving report in VB by using following code.
Set rReport1 = New CrDailyGroupDetail
rReport1.RecordSelectionFormula = "{recap.recapdate} = #" & Me.DTPicker1.Value & "# and ({recap.recaptimestamp} = 'A' or {recap.recaptimestamp} = 'AM' ) and {recap.grouptype} in ['Motor Carrier', 'Motor Fuel']"
rReport1.txtTimeStamp.SetText "AM"
frmReport1.CRViewer1.ReportSource = rReport1
frmReport1.Caption = "JFK Group Detail"
frmReport1.CRViewer1.ViewReport
frmReport1.WindowState = 2
frmReport1.CRViewer1.Zoom (100)
frmReport1.Show
rReport1.SaveAs "h:\recap_rewrite\JFK Daily Report\JFK DailyGroupDetail" & Date, cr80FileFormat

VB keep giving me invalid directory message (the directory is valided, I checked!) Any clue anybody?

Thanks!

 
I wonder if this is because the path contains spaces?

You could try:

rReport1.SaveAs chr(34) & "h:\recap_rewrite\JFK Daily Report\JFK DailyGroupDetail" & Date & chr(34), cr80FileFormat

which should wrap quotes around it.
 
I think the problem is with Date. Try formatting it first:

rReport1.SaveAs "h:\recap_rewrite\JFK Daily Report\JFK DailyGroupDetail" & Format(Date, "MM-DD-YYYY") & ".rpt", cr80FileFormat

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top