Home > Archive > Programming with dBASE > December 2005 > LOOKUP Inquiry









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author LOOKUP Inquiry
Jerry

2005-12-02, 8:23 pm

Hello,

I'm wondering if the LookupSQL & LookupRowset may be something I want to
implement in my programs. I've searched the newsgroups and not been able to
find anything. Does anyone know where I could find some lessons or examples
of code using these two commands? I'm building a directory program
(similiar to Windows Explorer) to keep track of file names, etc. and I'm
wondering if this wouldn't be something for me to look into.


Thanks,

Jerry Rivenbark



Ken Mayer [dBVIPS]

2005-12-02, 8:23 pm

Jerry wrote:
> Hello,
>
> I'm wondering if the LookupSQL & LookupRowset may be something I want to
> implement in my programs. I've searched the newsgroups and not been able to
> find anything. Does anyone know where I could find some lessons or examples
> of code using these two commands? I'm building a directory program
> (similiar to Windows Explorer) to keep track of file names, etc. and I'm
> wondering if this wouldn't be something for me to look into.


Very useful in a lot of cases. One place to look is my book:

http://www.goldenstag.net/dbase/dBASEBook.htm

<g>

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Les Shewchuk

2005-12-05, 8:24 pm

The simplest example for it's use...

Washington=WA
Oregon=OR
California=CA

You want to display the full name of the state on the form, but in the table
you only want to store the 2 character code AND you want to force the user
to select one (so they cannot make a typo).

Populate a table with at least the StateCode and StateName fields. Then set
the Lookup relationship (I prefer the LookupRowset myself, it creates fewer
temporary tables)

The nice part is form/query designers also handle the control replacement on
their own. Once you have created the lookup, close the designer and re-open
it. The entryfield in the palette will be replaced with a drop-down
control.

To set up a lookup rowset;

In the Lookup table, the first field selected needs to be the code field,
the second is the replacement. If you use "Select * from States.dbf" then
it has to be the first field in the table. If the code is NOT the first
field, then you can override the selection order by picking the fields in
the SQL property of the query.

Select StateCode, StateName from States.dbf

Drag your parent table on to the form.
Drag Your Lookup Table onto the form.
In your Lookup table, set your display order index. (i.e., list states
alphabetically)
On the parent table, dig down the properties of the field, and change the
lookup rowset to appropriate set, (all the available tables will appear on
the drop list)
close the designer.
Re-open the designer.

Les Shewchuk

"Jerry" <RivenbarkJerry@aol.com> wrote in message
news:orTJRK59FHA.1228@news-server...
> Hello,
>
> I'm wondering if the LookupSQL & LookupRowset may be something I want to
> implement in my programs. I've searched the newsgroups and not been able
> to find anything. Does anyone know where I could find some lessons or
> examples of code using these two commands? I'm building a directory
> program (similiar to Windows Explorer) to keep track of file names, etc.
> and I'm wondering if this wouldn't be something for me to look into.
>
>
> Thanks,
>
> Jerry Rivenbark
>
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com