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

Using criteria to create a dialog box to type search terms

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


Joined: 06 May 2009
Posts: 1

PostPosted: Wed May 06, 2009 11:01 am    Post subject: Using criteria to create a dialog box to type search terms Reply with quote

Hi guys. My first post here.

I have a database for my music projects. The table is a list of sound names I've created, plus a description field with a number of different description terms in it.

I'm trying to make a query so that I can type in two or three search terms into a dialog box and it will bring up any sounds that have these search terms in the description field.

In Microsoft Access I would type the following into the criteria field of the description column in the query design page: Like "*" & [Term 1] & "*" And Like "*" & [Term 2] & "*" And Like "*" & [Term 3] & "*"

This code doesn't work in Base, so what would I need to enter to get the same result?

Any help would be great.

Many thanks,
Matt
Back to top
View user's profile Send private message
Sliderule
Super User
Super User


Joined: 29 May 2004
Posts: 2474
Location: 3rd Rock From The Sun

PostPosted: Wed May 06, 2009 3:19 pm    Post subject: Reply with quote

Matt:

Welcome to OpenOffice.

I will assume, since you did not say, that you are working with the 'default' embedded database engine HSQL rather than being 'linked' to some other database engine ( such as, MySQL, SQLite, PostGRE, MS Access, dBase, Paradox, Oracle etc ), and, you can confirm this by looking at the status line, at the bottom, if it says: HSQL database engine then what I have written below applies.

Now, the answer also, depends on which version of OpenOffice you are using
  1. With OpenOffice Version 3.0.1 AND prior releases:

    the notation to indicate a 'prior' or 'post' entry as you have asked in Microsoft Access ( "*" ) canNOT be 'concatenated' with the prompt. But, a work-around is to have the user INCLUDE it in the response. And, with HSQL, the code is the literal, a percent sign: % .

    So, you could enter multiple prompts, each on an Or line. Each Parameter Prompt begins with a colon : , and is one word - no spaces. Therefore, if you were to write it with SQL, it would look like this:
    Code:
    Like :Enter_Pct_String1_Pct OR Like :Enter_Pct_String2_Pct OR Like :Enter_Pct_String3_Pct

  2. As of OpenOffice 3.1( now available for download ) . . . it will allow you accomplish the task with the following code:
    Code:
    Like '%' || :Enter_Search_String1 || '%' OR Like '%' || :Enter_Search_String2 || '%' OR Like '%' || :Enter_Search_String3 || '%'

    Note in the above, a LITERAL is enclosed with SINGLE QUOTES, so, use '%' , and, two pipes are used for concatenation ||

I hope this helps, please be sure to let me / us know.

Sliderule

Thanks to add [Solved] in your first post title ( edit button ) if your issue has been fixed / resolved.
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