OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Question on displaying results of a query generated by form

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
Tigerpaw28
Newbie
Newbie


Joined: 12 Jul 2010
Posts: 2

PostPosted: Mon Jul 12, 2010 8:21 am    Post subject: Question on displaying results of a query generated by form Reply with quote

I have a database I created to list VHS tapes and DVDs that I own. I've also created a form to use with it, wherein a user can search the database by entering a title, entering a studio, selecting a screen format (wide/full/both/any) from a dropdown list, selecting a release format (VHS/DVD/both/any) or enter no information at all (which results in the full database being returned). After setting the search parameters, the user clicks a button on the form which runs a macro to do three things:

1. Create the SQL query
2. Execute the query
3. Display the results of the query to the user

I have the first two working without issue. However, I'm at a loss at how to accomplish the last part. I thought I could feed the query to a report, but I couldn't find any examples of how to do so with a query that isn't saved as a Query.

-Tigerpaw28
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2697
Location: Apeldoorn, Netherland

PostPosted: Mon Jul 12, 2010 10:20 am    Post subject: Reply with quote

Hello

Use the Basetools extension of Benitez.

Romke
Back to top
View user's profile Send private message
Tigerpaw28
Newbie
Newbie


Joined: 12 Jul 2010
Posts: 2

PostPosted: Mon Jul 12, 2010 11:21 am    Post subject: Reply with quote

Ah, thanks. I think BaseTools will do what I need, though now I'm running into a problem with that. I have the following code set up:
Code:
Sub RunQuery_UponPress(Event As Object)
GlobalScope.BasicLibraries.LoadLibrary("BaseTools")
oForm = Event.Source.Model.Parent
QR="SELECT ""Video"".* FROM ""Video"" WHERE (((""Video"".""ReleaseFormat"") Like '%" & oForm.GetByName("Released").text & "%' ) AND ((""Video"".""VideoFormat"") Like '%" & oForm.GetByName("Media2").text & "%' ) AND ((""Video"".""ScreenFormat"") Like '%" & oForm.GetByName("Screen").text & "%' ) AND ((""Video"".""Title"") Like '%" & oForm.GetByName("Tibox").text & "%') AND ((""Video"".""Studio"") Like '%" & oForm.GetByName("Sbox").text & "%'))"
RunCmd.OpenSQL(QR)
End Sub


But when the code is triggered, there's no output. Am I misinterpreting the purpose of OpenSQL?

-Tigerpaw28
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2697
Location: Apeldoorn, Netherland

PostPosted: Mon Jul 12, 2010 11:56 am    Post subject: Reply with quote

Hello

The most important thing you donot understand is the filter working of a form. Each form does have a filter property what is the where part of a query. When you fill in that part and reload that form then you see the result. This is done by the filter sub in the basetools.

A form is a query and you extend this query with an other where part. You can easy test this when you put is a test in the filter of your form. Or use the formfilter and see what is in the filter property

Romke
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group