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 listbox for search in database

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


Joined: 24 Mar 2004
Posts: 3
Location: Hungary

PostPosted: Wed Mar 24, 2004 3:27 am    Post subject: using listbox for search in database Reply with quote

Hi!

I'm a newbie and need some help: Can I communicate with the database trough listbox or combobox? I've got a database of contacts and I like to select the name of the contact (it is the primary key) from a listbox with a watch its datas in textboxes. Is there any way to do it?

fudosin
Back to top
View user's profile Send private message Send e-mail
PBiela
Power User
Power User


Joined: 10 Feb 2004
Posts: 56
Location: Frankfurt/Main Germany

PostPosted: Wed Mar 24, 2004 9:46 am    Post subject: Reply with quote

hello,

there were some interesting threads on this topic allready try these two from dfrench

http://www.oooforum.org/forum/viewtopic.php?p=17880#17880

http://www.oooforum.org/forum/viewtopic.php?t=4257&highlight=listbox+data+form+control

PBiela
_________________
Question Who is John Galt? - Ayn Rand Question
Back to top
View user's profile Send private message
fudosin
Newbie
Newbie


Joined: 24 Mar 2004
Posts: 3
Location: Hungary

PostPosted: Thu Mar 25, 2004 2:59 am    Post subject: Reply with quote

Hello!

Thanks for the info, it was great help for me! As I tried it I find the next:
if you set the "content type" of the second form, where the ListBox is, to "table" instead of "SQL", you can modify the other fields of the recors.
Back to top
View user's profile Send private message Send e-mail
fudosin
Newbie
Newbie


Joined: 24 Mar 2004
Posts: 3
Location: Hungary

PostPosted: Tue Mar 30, 2004 1:06 am    Post subject: Reply with quote

Hi!

Thanks again for the informations, it was wery useful. Now I've got another problem, but first I must explain what is the purpose of my job:
I have to build up a database system for cathodic protction installments of pipelines, tanks etc. There's an important part of this systems that called test points, where we can do measurements. Evry pipeline has many test points and sometimes a test point has connection more than one pipeline.

Now I've got seven table, but only two is important now:
The first one called "InstallmentName" and contain the data of the installments. There's two important column in it: "InstName" and "InstCode", where store the unique code of the installments and this is the primary key.
The second one called "Bonds". The important columns: "Num" is the unique number of the test point, "InstCode" is the same as in the "InstallmentName", and "NumBond" is the ordinal number of the installment connection. So evry test point has as many rows as connections it has. Because of this, I had to define an auto increasement colmn for key.

And now I have to build up a form for the next:

1. Select an installment by name from a ListBox.
2. Show the related test point numbers distincted in another TextBox.
3. If select a test point show it's connections in a Table.

The first pont is no problem, thanks for your help, and halfy can do the second: listing the test points in a table is OK, with named parameter in a subform, but when I try to make the second TextBox The OOo set the type of the subform to "table" and the list contain evry item of the table. When I manually set back to "SQR" the list is changing some unknown way but it's grayed out.

Do you have any ideas, what can I do with it?

fudosin
Back to top
View user's profile Send private message Send e-mail
PBiela
Power User
Power User


Joined: 10 Feb 2004
Posts: 56
Location: Frankfurt/Main Germany

PostPosted: Wed Mar 31, 2004 11:43 pm    Post subject: Reply with quote

hi Fudosin,

For the 2. point I would use a Listbox insted of a Textbox, thus you can feed it with a sql statemant to show the neede Num-Values.

Code:


   oListBox= oForm.getByName("ListBox")
   oListBox.ListSourceType= 3
   SQL_Code = "Select ... "   ' as String
   SourceArr = Array( SQL_Code )
   oListBox.ListSource = SourceArr(0)



Thus the Listbox contains just the Items matching your SQL statment. The Subform has to be conected to the Tabel "Bonds". If you create the listbox not able to pop open. It will display more then one result, just like a textbox.

For your third point, it seems to be the quickest way using a query over your tables, but then you would have to create a query dynamic. That is possible but I don't know how, since I haven't had to do this yet.

Hope this helped you a bit...

Peter Biela
_________________
Question Who is John Galt? - Ayn Rand Question
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