Hi everyone. I have a search menu that works if I select "ALL", with
tells me "ALIAS NOT FOUND" if I try to search by typing in the first
few letters of the patient's last name. Here is the code I am using:

#DEFINE DELKEY 127

LPARAMETERS nKeyCode, nShiftAltCtrl
LOCAL cDisplayValue
IF nKeyCode = DELKEY
cDisplayValue = ALLTRIM(THIS.DisplayValue)
IF LEN(m.cDisplayValue)=1
cDisplayValue = ""
ELSE
cDisplayValue = LEFT(cDisplayValue,LEN(cDisplayValue)-1)
ENDIF
ELSE
cDisplayValue = ALLTRIM(THIS.DisplayValue)+CHR(nKeyCode)
ENDIF

THISFORM.LockScreen = .T.
DO CASE
CASE EMPTY(m.cDisplayValue)
THISFORM.grdcust.recordsource = " "
CASE THIS.Value = "(All)"
SELECT l_name AS lname,* FROM patients;
INTO CURSOR Custs
thisform.grdcust.recordsource = "Custs"
OTHERWISE
SELECT l_name AS lname,* FROM patients ;
WHERE UPPER(ALLTRIM(l_name.patients)) = UPPER(m.cDisplayValue);
INTO CURSOR Custs
thisform.grdcust.recordsource = "Custs"
ENDCASE
THISFORM.ResetCombos(THIS)
THISFORM.LockScreen = .F.
_____________________________________________________________________________
In my other search field, I have the search set up so that all of the
patients last name's appear in the drop down menu in alphabetical
order, but if I select a last name to display, I get the error "ALIAS
L_NAME IS NOT FOUND". Here is the code I am using here:

LOCAL cDisplayValue
THISFORM.LockScreen = .T.
IF THIS.Value = "(All)"
SELECT l_name AS Location,* FROM patients INTO CURSOR pats ORDER BY
l_name
thisform.grdcust.recordsource = "pats"
ELSE
SELECT l_name AS Location,* FROM patients ;
WHERE UPPER(ALLTRIM(l_name.patients)) = UPPER(ALLTRIM(THIS.Value));
INTO CURSOR pats
thisform.grdcust.recordsource = "pats"
ENDIF
THISFORM.ResetCombos(THIS)
THISFORM.LockScreen = .F.
------------------------------------------------------------------------------------------------------------------------------------

I have both of these codes in the Interactive Change of each combobox.
Can someone please point me in the right direction?

Thanks in advance.

Arvin

RE: Need Help with Search by CathyNeppel

CathyNeppel
Thu Aug 17 13:31:49 CDT 2006

In both cases I think you have your Table.field turned around in your where
clause
WHERE UPPER(ALLTRIM(l_name.patients)) ...
should be
WHERE UPPER(ALLTRIM(patients.l_name)) ...

HTH
Cathy

"wickedbusa" wrote:

> Hi everyone. I have a search menu that works if I select "ALL", with
> tells me "ALIAS NOT FOUND" if I try to search by typing in the first
> few letters of the patient's last name. Here is the code I am using:
>
> #DEFINE DELKEY 127
>
> LPARAMETERS nKeyCode, nShiftAltCtrl
> LOCAL cDisplayValue
> IF nKeyCode = DELKEY
> cDisplayValue = ALLTRIM(THIS.DisplayValue)
> IF LEN(m.cDisplayValue)=1
> cDisplayValue = ""
> ELSE
> cDisplayValue = LEFT(cDisplayValue,LEN(cDisplayValue)-1)
> ENDIF
> ELSE
> cDisplayValue = ALLTRIM(THIS.DisplayValue)+CHR(nKeyCode)
> ENDIF
>
> THISFORM.LockScreen = .T.
> DO CASE
> CASE EMPTY(m.cDisplayValue)
> THISFORM.grdcust.recordsource = " "
> CASE THIS.Value = "(All)"
> SELECT l_name AS lname,* FROM patients;
> INTO CURSOR Custs
> thisform.grdcust.recordsource = "Custs"
> OTHERWISE
> SELECT l_name AS lname,* FROM patients ;
> WHERE UPPER(ALLTRIM(l_name.patients)) = UPPER(m.cDisplayValue);
> INTO CURSOR Custs
> thisform.grdcust.recordsource = "Custs"
> ENDCASE
> THISFORM.ResetCombos(THIS)
> THISFORM.LockScreen = .F.
> _____________________________________________________________________________
> In my other search field, I have the search set up so that all of the
> patients last name's appear in the drop down menu in alphabetical
> order, but if I select a last name to display, I get the error "ALIAS
> L_NAME IS NOT FOUND". Here is the code I am using here:
>
> LOCAL cDisplayValue
> THISFORM.LockScreen = .T.
> IF THIS.Value = "(All)"
> SELECT l_name AS Location,* FROM patients INTO CURSOR pats ORDER BY
> l_name
> thisform.grdcust.recordsource = "pats"
> ELSE
> SELECT l_name AS Location,* FROM patients ;
> WHERE UPPER(ALLTRIM(l_name.patients)) = UPPER(ALLTRIM(THIS.Value));
> INTO CURSOR pats
> thisform.grdcust.recordsource = "pats"
> ENDIF
> THISFORM.ResetCombos(THIS)
> THISFORM.LockScreen = .F.
> ------------------------------------------------------------------------------------------------------------------------------------
>
> I have both of these codes in the Interactive Change of each combobox.
> Can someone please point me in the right direction?
>
> Thanks in advance.
>
> Arvin
>
>

Re: Need Help with Search by wickedbusa

wickedbusa
Thu Aug 17 18:13:55 CDT 2006

Thank you Cathy. It worked. I guess I was just too tired to see that I
had it backwards =/.

Thanks again!

Arvin
Cathy Neppel wrote:
> In both cases I think you have your Table.field turned around in your where
> clause
> WHERE UPPER(ALLTRIM(l_name.patients)) ...
> should be
> WHERE UPPER(ALLTRIM(patients.l_name)) ...
>
> HTH
> Cathy
>
> "wickedbusa" wrote:
>
> > Hi everyone. I have a search menu that works if I select "ALL", with
> > tells me "ALIAS NOT FOUND" if I try to search by typing in the first
> > few letters of the patient's last name. Here is the code I am using:
> >
> > #DEFINE DELKEY 127
> >
> > LPARAMETERS nKeyCode, nShiftAltCtrl
> > LOCAL cDisplayValue
> > IF nKeyCode = DELKEY
> > cDisplayValue = ALLTRIM(THIS.DisplayValue)
> > IF LEN(m.cDisplayValue)=1
> > cDisplayValue = ""
> > ELSE
> > cDisplayValue = LEFT(cDisplayValue,LEN(cDisplayValue)-1)
> > ENDIF
> > ELSE
> > cDisplayValue = ALLTRIM(THIS.DisplayValue)+CHR(nKeyCode)
> > ENDIF
> >
> > THISFORM.LockScreen = .T.
> > DO CASE
> > CASE EMPTY(m.cDisplayValue)
> > THISFORM.grdcust.recordsource = " "
> > CASE THIS.Value = "(All)"
> > SELECT l_name AS lname,* FROM patients;
> > INTO CURSOR Custs
> > thisform.grdcust.recordsource = "Custs"
> > OTHERWISE
> > SELECT l_name AS lname,* FROM patients ;
> > WHERE UPPER(ALLTRIM(l_name.patients)) = UPPER(m.cDisplayValue);
> > INTO CURSOR Custs
> > thisform.grdcust.recordsource = "Custs"
> > ENDCASE
> > THISFORM.ResetCombos(THIS)
> > THISFORM.LockScreen = .F.
> > _____________________________________________________________________________
> > In my other search field, I have the search set up so that all of the
> > patients last name's appear in the drop down menu in alphabetical
> > order, but if I select a last name to display, I get the error "ALIAS
> > L_NAME IS NOT FOUND". Here is the code I am using here:
> >
> > LOCAL cDisplayValue
> > THISFORM.LockScreen = .T.
> > IF THIS.Value = "(All)"
> > SELECT l_name AS Location,* FROM patients INTO CURSOR pats ORDER BY
> > l_name
> > thisform.grdcust.recordsource = "pats"
> > ELSE
> > SELECT l_name AS Location,* FROM patients ;
> > WHERE UPPER(ALLTRIM(l_name.patients)) = UPPER(ALLTRIM(THIS.Value));
> > INTO CURSOR pats
> > thisform.grdcust.recordsource = "pats"
> > ENDIF
> > THISFORM.ResetCombos(THIS)
> > THISFORM.LockScreen = .F.
> > ------------------------------------------------------------------------------------------------------------------------------------
> >
> > I have both of these codes in the Interactive Change of each combobox.
> > Can someone please point me in the right direction?
> >
> > Thanks in advance.
> >
> > Arvin
> >
> >