VFP 9 SP1:
Populating a grid with cursor as the recordsource.
Here's my code:
select county, countycode, certnumber, lastname, ;
firstname, permaddr, permcity, dob ;
from realdbf ;
where realdbf.lastname=m.mlastname and ;
realdbf.firstname=m.mfirstname and ;
realdbf.dob = m.mdob;
into cursor crsTemp NOFILTER
select (thisform.grdMyGrid.recordsource)
append from dbf( [crsTemp] )
use in crsTemp
index on lastname+dob tag lndob
set order to tag lndob
go top in (thisform.grdMyGrid.recordsource) && A CURSOR
thisform.grdMyGrid.refresh()
The user selects a county dbf via a combobox and the dbf is opened with the alias "realdbf". Then they type in the m.mlastname, m.mfirstname and m.mdob fields to set up the search strings.
The above code is called when they click on the Search button.
Works great.
So I wanted to improve it some and create a reset button to re-init the m.mlastname, etc. vars so the user had a "clean slate" with which to start the next search if they were searching within the same county dbf. Let's call it the "New Search" button. (I already have a "Reset All" button that starts from scratch, meaning it zaps the grid's recordsource cursor, re-inits the memvars and sets focus back to the DBF selecting combobox. )
The "new Search" button also zaps the grid's recordsource and re-inits the memvars but when the Select is called the cursor crsTemp is always empty.
The only difference in the Reset All button and the New Search button is that the New search Button doesn't close the realdbf and open another one.
I hope I'm explaining this well.
So in trying to debug this I tried leaving out the NOFILTER clause in the Select statement. When I do, it appears that the WHERE clauses are ignored for it returns all records from the realdbf.
Is this how it is supposed to work? And if so, why?
Leaving off the NOFILTER does not change the wierd behaviour of the New Search button, though.
Thanks for reading this.
Populating a grid with cursor as the recordsource.
Here's my code:
select county, countycode, certnumber, lastname, ;
firstname, permaddr, permcity, dob ;
from realdbf ;
where realdbf.lastname=m.mlastname and ;
realdbf.firstname=m.mfirstname and ;
realdbf.dob = m.mdob;
into cursor crsTemp NOFILTER
select (thisform.grdMyGrid.recordsource)
append from dbf( [crsTemp] )
use in crsTemp
index on lastname+dob tag lndob
set order to tag lndob
go top in (thisform.grdMyGrid.recordsource) && A CURSOR
thisform.grdMyGrid.refresh()
The user selects a county dbf via a combobox and the dbf is opened with the alias "realdbf". Then they type in the m.mlastname, m.mfirstname and m.mdob fields to set up the search strings.
The above code is called when they click on the Search button.
Works great.
So I wanted to improve it some and create a reset button to re-init the m.mlastname, etc. vars so the user had a "clean slate" with which to start the next search if they were searching within the same county dbf. Let's call it the "New Search" button. (I already have a "Reset All" button that starts from scratch, meaning it zaps the grid's recordsource cursor, re-inits the memvars and sets focus back to the DBF selecting combobox. )
The "new Search" button also zaps the grid's recordsource and re-inits the memvars but when the Select is called the cursor crsTemp is always empty.
The only difference in the Reset All button and the New Search button is that the New search Button doesn't close the realdbf and open another one.
I hope I'm explaining this well.
So in trying to debug this I tried leaving out the NOFILTER clause in the Select statement. When I do, it appears that the WHERE clauses are ignored for it returns all records from the realdbf.
Is this how it is supposed to work? And if so, why?
Leaving off the NOFILTER does not change the wierd behaviour of the New Search button, though.
Thanks for reading this.