Page 1 of 1

query to list box?

PostPosted: Wed Sep 24, 2014 7:26 am
by yanzco
if i type a query to a table..
ex. chicken

i wanted to have a button that when i clicked, shows a list box, containing all results query.

like this..
------------------v
chicken a
chicken b
chicken c
etc
etc

then if a selection is made..

it is clicked also on the table.. ( active record )


another turn around i thought was..

make a hidden db table..
then when the button is clicked..
it shows the table with the query search..

then gives me the query results to choose from..
when clicked.. the object table hides and the active record is selected?

or maybe double click is better suited to do the table hide when clicked..

Re: query to list box?

PostPosted: Wed Sep 24, 2014 7:51 am
by Gaev
yanzco:

i wanted to have a button that when i clicked, shows a list box, containing all results query.

like this..
------------------v
chicken a
chicken b
chicken c
etc
etc

Take a look in the Help file to see how dbpFieldToVar works ... take particular note of ...
If you plan on displaying the data in a List or Combo box, you should use a carriage return as your delimiter. In NeoBook a carriage return is entered as "[#13]".



then if a selection is made..
it is clicked also on the table.. ( active record )

You could ...

- either loop through the current set of records (using dbpFirst and dbpNext) ... and check the selection (e.g. "chicken c") against the actual field values ... when found, exit the Loop.

- or do another dbpQuery using the selected content ... you will get a grid with just the matching record(s)


another turn around i thought was..

make a hidden db table..
then when the button is clicked..
it shows the table with the query search..

then gives me the query results to choose from..
when clicked.. the object table hides and the active record is selected?

Why use two Tables ? ... just do a dbpQuery for (say) "chicken" ... you will see all matching records ... click on the one you want and it becomes the current record.