Open a report via button - worked on 2.3, not on 3.0

Getting your data onto paper - or the web - Discussing the reports features of Base
Post Reply
openmind
Posts: 1
Joined: Tue Sep 30, 2008 11:31 am

Open a report via button - worked on 2.3, not on 3.0

Post by openmind »

Hi folks,

I made an application under BASE OOo 2.3, in which buttons opened reports, with the script:

Code: Select all

Function OpenReport( formContainer as variant, oConnection as variant, sFormName as string, optional strMode as string ) as variant
	Dim aProp(1) As New com.sun.star.beans.PropertyValue
	dim openMode as string
	         
	if ismissing( strMode ) then
		openMode = "open"
	else
		openMode = strMode
	endif
	aProp(0).Name = "ActiveConnection"
	aProp(0).Value = oConnection
	aProp(1).Name = "OpenMode"
	aProp(1).Value = strMode
	OpenReport = formContainer.loadComponentFromURL(sFormName,"_blank",0,aProp())
End Function
That worked fine, great.

But now, I'm testing my application under OOo 3.0, and this don't work anymore! Is someone have an explanation? (Note that I use the same kind of function to open Forms, and that work fine.)

Thanks for your help,
Openmind
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Open a report via button - worked on 2.3, not on 3.0

Post by Villeroy »

How exactly do you call the macro(which button event)?
What means "don't work anymore"?
Does the office freeze or crash (hopefully not)?
Error message (which)?
Does the Basic IDE pop up (in which module)?
Is a certain line highlighted (which)?
Nothing happens at all? What makes you shure that "Function OpenReport(with 4 arguments)" gets called anyway?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
SpookyMM
Posts: 11
Joined: Fri Nov 13, 2009 8:29 pm

Re: Open a report via button - worked on 2.3, not on 3.0

Post by SpookyMM »

I can open a report via button too. Is another solution ?
OpenOffice 3.1
evwool
Volunteer
Posts: 401
Joined: Fri Oct 09, 2009 9:40 pm
Location: UK

Re: Open a report via button - worked on 2.3, not on 3.0

Post by evwool »

I use this:

Code: Select all

Sub OpenMyReport(oEvent As Object)
Dim RptName as string
RptName = "RptOrderSummary"
'the name of the report I want to open
ThisDatabaseDocument.ReportDocuments.getByName(RptName).open
End Sub
OpenOffice 3.1.1 on Windows XP and on Windows 7 Starter
jump_ace
Posts: 4
Joined: Sat May 07, 2011 11:06 pm

Re: Open a report via button - worked on 2.3, not on 3.0

Post by jump_ace »

Hello,

I am having trouble following where I go to insert the SQL code for the button to open my report. I'm pasting the following code into the Button (Form) Properties > Comment field, is that the right place to do it? I'd like to use this code, but in OOo 3.3 it says there is a syntax error?:

Code: Select all

Sub OpenMyReport(oEvent As Object)
Dim RptName as string
RptName = "rptComicsListQuery"
ThisDatabaseDocument.ReportDocuments.getByName(RptName).open
End Sub
A little background...I'm building a Comic Book Database where I want to search for what comic book is in which comic book box (numbered). So I don't have to go thumbing around so much. So, for example my form has the field 'Comic Name' and when I type in 'Amazing Spider-Man' I want the results to appear in the report (once I click this stubborn button! lol). If it helps, I've attached my DB to fileserve and feel free to look it over (I'm also not sure if I set up the form Filters properly - since I can't run the report yet):

http://www.fileserve.com/file/gQDMsnG

Thanks in advance!


Jerome
OpenOffice 3.3
RPG
Volunteer
Posts: 2250
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Open a report via button - worked on 2.3, not on 3.0

Post by RPG »

Hello

I think it is better to base your report on a query with a parameter who you can input when this query is excute. See the help file how to use this kind of query.

Romke
LibreOffice 7.1.4.2 on openSUSE Leap 15.2
jump_ace
Posts: 4
Joined: Sat May 07, 2011 11:06 pm

Re: Open a report via button - worked on 2.3, not on 3.0

Post by jump_ace »

Did someone delete my post? I want to use a form button to open a report based on what was inputted in the form. I don't know what you are referring to with basing the report on a query. I need to be able to search for any criteria and have the report pop up once you click the button.

Jerome
OpenOffice 3.3
User avatar
Hagar Delest
Moderator
Posts: 32667
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Open a report via button - worked on 2.3, not on 3.0

Post by Hagar Delest »

jump_ace wrote:Did someone delete my post?
What do you mean??? Your post is just above. You've made another one it seems, click the View your posts link top of the page to see all your posts.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
RPG
Volunteer
Posts: 2250
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Open a report via button - worked on 2.3, not on 3.0

Post by RPG »

Hello

If you do not understand my answer it seems to me you have not read any tutorial about OOo-base. I think reading tutorials is the best way to understand how OOo-base is working. You can start with a tutorial of Arineckaig
http://user.services.openoffice.org/en/ ... =5&t=35658

or

http://openoffice.org/projects/document ... 20tutorial

I have read your other question what is not related to this post. Maybe you get answer there.

Romke
LibreOffice 7.1.4.2 on openSUSE Leap 15.2
jump_ace
Posts: 4
Joined: Sat May 07, 2011 11:06 pm

Re: Open a report via button - worked on 2.3, not on 3.0

Post by jump_ace »

I had made a second post earlier where I pasted in the code from the Access file I created. I'm pretty certain Romke deleted it. And you are wrong Romke, the thread is called 'Open a report via button' which is EXACTLY what I am asking for help with. Deleting my second post and not taking the time to answer my question (not give a workaround) isn't acceptible. I've since removed OOo and will just forget about switching over to OOo, thanks for nothing :roll:

Jerome
OpenOffice 3.3
User avatar
Hagar Delest
Moderator
Posts: 32667
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Open a report via button - worked on 2.3, not on 3.0

Post by Hagar Delest »

jump_ace wrote:I had made a second post earlier where I pasted in the code from the Access file I created. I'm pretty certain Romke deleted it.
Romke cannot edit posts from other users. Only the moderators can do that (green username). You can edit your own posts if you want to add that code.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Open a report via button - worked on 2.3, not on 3.0

Post by RoryOF »

If you press "View your posts" towards the middle top of the Forum screen, you will see all your posts. There are four from your user-name.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Post Reply