4 Replies - 3534 Views - Last Post: 03 December 2009 - 01:57 PM Rate Topic: -----

#1 raycomp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 25-August 09

Export data report to html

Posted 02 December 2009 - 07:19 AM

Im using vb6 with the following code to export my data report to html.

It opens a Export dialog form so that the user must select the directory, supply the file name etc.

I would like to adapt the code so that the Save in field and file name field will be pre filled in with something like

the Save in = App.Path & "\Reports"
file name = txtData(16).Text = .FileName
save as type = HTML


DioI use a common dialog and if so how.

Sub ExportInvoice()

	With objRs
		If .State <> adStateClosed Then .Close
		.ActiveConnection = dbcn
		.CursorLocation = adUseClient
		.CursorType = adOpenStatic
		.LockType = adLockBatchOptimistic
		If .State <> adStateClosed Then .Close
		.CursorLocation = adUseClient
		.CursorType = adOpenKeyset
		.Source = ("select * from OrderDetails where ID = '" & txtorder(0) & "'")
		.Open
	
		Set SalesReport.DataSource = objRs

'code to pre fill dialogue box opened by the next statement

'the Save in = App.Path & "\Reports" 
 'file name	 = txtData(16).Text = .FileName 
'save as  type  = HTML


		SalesReport.ExportReport rptKeyHTML, , , True

	End With
	
End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: Export data report to html

#2 kasbaba  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 133
  • Joined: 03-November 08

Re: Export data report to html

Posted 02 December 2009 - 08:53 AM

View Postraycomp, on 2 Dec, 2009 - 06:19 AM, said:

I would like to adapt the code so that the Save in field and file name field will be pre filled in with something like


Add a CommonDialog Control to your form from the ToolBox.
To save a file do the following:

With CommonDialog1
.InitDir = App.Path & "\Reports"
'Remember to use *.html or *.htm or both if needed.
.FileName = txtData(16).Text
.DefaultExt = "*.html"
.Filter = "HTML File (*.html) |*.html|All Files (*.*)|*.*"
.ShowSave
End With



Let me know if this helps !!
Was This Post Helpful? 0
  • +
  • -

#3 raycomp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 25-August 09

Re: Export data report to html

Posted 02 December 2009 - 11:38 AM

Not working. I have done what you suggested but how do I specify to save salesreport. As this is a data report that I need to save the only option is SalesReport.ExportReport

Your suggestion open a Save AS Dialogue form and add the directory and file name correctly but does not save the report as SalesReport.Savefile is not an option

while the SalesReport.ExportReport opens an export dialogue form and it is on this form that I want to add the directory and filename.

Hope this makes sense

Sub printInvoice()

	With objRs
		If .State <> adStateClosed Then .Close
		.ActiveConnection = dbcn
		.CursorLocation = adUseClient
		.CursorType = adOpenStatic
		.LockType = adLockBatchOptimistic
		If .State <> adStateClosed Then .Close
		.CursorLocation = adUseClient
		.CursorType = adOpenKeyset
		.Source = ("select * from OrderDetails where ID = '" & txtorder(0) & "'")
		.Open
	
		Set SalesReport.DataSource = objRs
	End With
	
	SalesReport.Show
	
With cd1
.InitDir = App.Path & "\Reports"
'Remember to use *.html or *.htm or both if needed.
.FileName = txtorder(3).Text
.DefaultExt = "*.html"
.Filter = "HTML File (*.html) |*.html|All Files (*.*)|*.*"
.ShowSave
End With
SalesReport.ExportReport
'salesReport.SaveFile not available
	
End Sub

Was This Post Helpful? 0
  • +
  • -

#4 kasbaba  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 133
  • Joined: 03-November 08

Re: Export data report to html

Posted 03 December 2009 - 07:10 AM

View Postraycomp, on 2 Dec, 2009 - 10:38 AM, said:

Not working. I have done what you suggested but how do I specify to save salesreport. As this is a data report that I need to save the only option is SalesReport.ExportReport


Try this.

Hope this helps.
Was This Post Helpful? 0
  • +
  • -

#5 raycomp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 25-August 09

Re: Export data report to html

Posted 03 December 2009 - 01:57 PM

Thanks but not what i want. I am attaching an extract from my prog for you to see the dialogue that I want to achieve.

trying to find a way to automatically fill in the the directory and the file name fields on nthe export dialogue form so that user don’t have to select directory and fill in file name

Something like

Save in should = App.Path & "\reports" 'where it should save the report
File name should = txtData(9). 'Set the file name to save.

I'm using the biblio database in vB in the sample code. Please change the connection source for the dataenvironment if required.

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1