Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clearing FIELDS

Status
Not open for further replies.

jackie1948

Programmer
Jan 25, 2002
78
US
How do you clear the fields on a form? I have tired thisform.refresh, release but the fields retain the last 'find' selection. I am in VFP7 i know this is a dum question but sometimes these are the ones that stump you the most. thanks for all the help that you guys give. you'll are 100% better than a manual.
 
There is no "easy" answer to this question, other than "it depends"!

Do you have data sources on the controls? Are they form properties or table fields? Is the "table" a cursor or view? Is the table buffered?

Rick
 
I have data source on the form properties. I have several tables accessed in this form. The form has a listbox that has an array (it clears with Release arrname)
The tables are cursors in the data environment . I do not think the tables are buffered. (not sure about buffering). not sure if i gave you the right answers
 
Just assign the control source to controlsource = '' Attitude is Everything
 
When using Form Properties as the control sources, then one way is to simply set all these values back to their default values. In a case like this, I usually create a user method (e.g. m_ResetDataProps) and set the values here. Then you can call this each time you start a new record (or the user decides not to save). Note: After changing these values, you'll need to do a ThisForm.Refresh() to see the changes.

Rick
 
The textboxes will always have a value showing unless your pointer is setting on a blank record (assuming the controlsource are the fields in a table).
There are ways around this, one method is setting the controlsource to M.[fieldname] then using scatter memvar and thisform.refresh to populate the textboxes and append blank, Gather memvar (or insert into [aliasname] from memvar) to update the table from the textbox values. to clear the textboxes set all the M.variables to empty().

this is not an easy answer but I use it all the time and it provides a lot of flexibility.
 
Hi MCTCO,

If your controls are bound to a table, alias, cursor, etc. they should display the value of the underlying record source. If you do a seek that returns a not found (e.g. found() would return .F.), the pointer will be placed at the EOF (e.f. EOF() would return .T.) and all controls bound to the underlying record source would be blank.
Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
On the next line after the seek would be:
scatter memvar
thisform.refresh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top