I cannot get this to work (I am such a dunce)
What I wanted to do was search for a NAME in a TABLE.
I have a TEXT Box as a Data Entry and I wanted to use an entry format like...
LAST NAME,FIRST NAME... where the comma was the clue that the letters followed were FIRST NAME..
I have put my code below... but come what may I cannot get the data to appear in the GRID... I have changed the grid RecordSource, the RecordSourceType...
Can someone tell me where I am going wrong....
Thanks
What I wanted to do was search for a NAME in a TABLE.
I have a TEXT Box as a Data Entry and I wanted to use an entry format like...
LAST NAME,FIRST NAME... where the comma was the clue that the letters followed were FIRST NAME..
I have put my code below... but come what may I cannot get the data to appear in the GRID... I have changed the grid RecordSource, the RecordSourceType...
Can someone tell me where I am going wrong....
Thanks
Code:
In TEXT1 Interactive Change - So I get immediate updates
SET CURSOR on
SELECT 1
*!* SET ORDER to 1 && PT_EPISODE
SET ORDER TO 2 && LAST_NAME
*GO top
cLName = ALLTRIM(thisform.text1.Value)
IF "," $ cLName
cLName1 = SUBSTR(cLname, 1, (ATC(",", cLname)-1))
cFName1 = ALLTRIM(SUBSTR(cLName, LEN(cLName1)+2, 10))
IF LEN(cFName1)> 0
SELECT patient_episodes.Last_name, patient_episodes.first_name, patient_episodes.file_num ;
FROM patient_episodes;
where patient_episodes.last_name= cLName1 and patient_episodes.first_name = cFName1;
INTO TABLE temp.dbf;
ORDER BY last_name
thisform.Refresh()
ELSE
SELECT patient_episodes.Last_name, patient_episodes.first_name, patient_episodes.file_num ;
FROM patient_episodes;
where patient_episodes.last_name= cLName1;
INTO TABLE temp.dbf;
ORDER BY last_name
thisform.grid1.visible =.t.
ENDIF
ELSE
SELECT patient_episodes.Last_name, patient_episodes.first_name, patient_episodes.file_num ;
FROM patient_episodes;
where patient_episodes.last_name= cLName;
INTO TABLE temp.dbf;
ORDER BY last_name
thisform.grid1.visible =.t.
ENDIF