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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmatically set RecordSource and Filter property

Status
Not open for further replies.

risicare

Programmer
Oct 14, 2002
13
GB
I'm using VB to change the SQL statement in the RecordSource property of a form. I would like the form to save the new SQL when it closes, so that the user goes back to the same record(s) they were at previously when they reopen the form.
Reading through Litwin and Getz it is clear that the filter property changed in this way is lost when the form is closed. Does this also apply to RecordSource?
There is hopefully a simple solution to this.
Thanks in advance
Jason
 
Yes. What you could do is save the SQL statement in a record in a table (and the key to the record the user was on). Then, in the OnOpen event of the form, read the record (assigned to that user) and set the Recordsource (etc) to the SQL statement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top