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

Accessing RecordSource of a Closed Form

Status
Not open for further replies.

dpatrickcollins

Programmer
Nov 18, 2002
79
How do I programmatically access the RecordSource property of an Access form that is closed? I am familiar with the AllForms collection, as follows:

Dim obj As Object
Dim dbs As Object

Set dbs = CurrentProject

Set obj = dbs.AllForms(0)

But when I proceed to do the following:

str = obj.RecordSource

I get an error that RecordSource is not part of the objects properties. Any ideas??
 
I am not totaly sure, but i do not think you can access the RecordSource property of a closed form. The form has to be loaded first.

What do you want to do?
 
The project is a longer story than you may wish to hear, but it essentially involves identifying the underlying table and field name of each bound control, preferrably without having to have the form open. The catch of opening the form programmatically in order to get to this info is that some form queries have parameter fields, thus, program code is halted as the parameter value prompt is displayed, awaiting user input. Not good.

I do have a work around (i.e. awaiting execution of the code at the time each form is loaded), but if you know of a way to obtain this info without opening the form, or bypassing any parameter prompt in opening the form, it would be appreciated.

Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top