How to save the RecordSource from a form as SQL?

  • Thread starter Thread starter Sidney Linkers
  • Start date Start date
S

Sidney Linkers

Hi All,

Is there a method for saving the RecordSource of a form as SQL? I want to be
able to do this even after the user put a filter on the form or changes the
sorting order. It gets more nasty if the form contains pulldown textboxes
with a recordsource of itself. MSAccess uses some type of internal table
referencenames which do not exist, but just for filtering purposes.

The whole idea behind this is to rember the view the user last has been
using and even give the user the ability to save a view (the full SQL string
hopefully).

Any help or suggestions would be great on this.

Sid.
 
Hi,

Thank you for choosing Microsoft Access newsgroup support.

There's not an internal table that you can read from. What you could
possibly do is read the properties:

- RecordSource
- OrderBy
- Filter

Note that if OrderByOn = False then "OrderBy" does not run. Same goes for
"Filter" and "FilterOn".

Example:

Debug.Print Me.RecordSource
IF Me.OrderByOn = True THEN
Debug.Print Me.OrderBy
End IF

IF Me.FilterOn = True THEN
Debug.Print Me.Filter
End IF

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."
 
Back
Top