| View previous topic :: View next topic |
| Author |
Message |
fudosin Newbie

Joined: 24 Mar 2004 Posts: 3 Location: Hungary
|
Posted: Wed Mar 24, 2004 3:27 am Post subject: using listbox for search in database |
|
|
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 |
|
 |
PBiela Power User


Joined: 10 Feb 2004 Posts: 56 Location: Frankfurt/Main Germany
|
|
| Back to top |
|
 |
fudosin Newbie

Joined: 24 Mar 2004 Posts: 3 Location: Hungary
|
Posted: Thu Mar 25, 2004 2:59 am Post subject: |
|
|
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 |
|
 |
fudosin Newbie

Joined: 24 Mar 2004 Posts: 3 Location: Hungary
|
Posted: Tue Mar 30, 2004 1:06 am Post subject: |
|
|
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 |
|
 |
PBiela Power User


Joined: 10 Feb 2004 Posts: 56 Location: Frankfurt/Main Germany
|
Posted: Wed Mar 31, 2004 11:43 pm Post subject: |
|
|
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 _________________
Who is John Galt? - Ayn Rand  |
|
| Back to top |
|
 |
|