How can I refer to closed form, table or query?

Ramzess II

Registered User.
Local time
Today, 15:31
Joined
Apr 7, 2004
Messages
32
Hello!

Is it possible to make a reference from a code within a report to a certain field in a form which is based on query or table? Or maybe it is better to refer
to that query or table this form is based on? Anyway, is it possible and if it is, - how?

By now I have to open the form where this certain field is and only then I can open a form, otherwise I get error about field which could not be found.

Thank you in advance.
 
Ramzes,

In order for a field on a form to have a value, the form must
be open.

If the form is not open, you can open the form's RecordSource
(table or query) and retrieve the information from there.

Wayne
 
You can open the form and keep it hidden from view with the following code

Code:
DoCmd.OpenForm "Name of Form", , , , , acHidden

You can then refer to fields on the form, just remember to close the form when you're finished with it.

HTH
 
Forms don't store data. You should not be opening forms to reference data from the form's RecordSource. If you need additional data for your form, the first thing to do is to look at adding the new table to the current form's RecordSource query. That way Jet will do the work of retrieving the data. The second choice would be a DLookup() and the third would be opening a DAO or ADO recordset.
 

Users who are viewing this thread

Back
Top Bottom