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

Syntax for subform reference

Status
Not open for further replies.

vb4me

Programmer
Nov 27, 2001
48
0
0
US
I need some help with referencing a subform.

I have my main form frmProductLine, in this I have a subform called frmProduct subform.

I have entered the following in a field in the frmProduct subform :
if (button = acleftbutton) then docmd.openform "frmcalander",,,,,,"frmProduct subform"

This works fine but the problem I have is that frmProduct subform also has its own subforms. frmTraining subform and frmProductInformation Subform.

If I use the command above and put in frmtraining subform instead of frm product I get an invalid use of null error.

So I believe I have to reference the subforms correctly but I do not know the syntax to put it in e.g forms!frmProduct subform!frmTraining subform or something,

any help would be appreciated.
 
Hi vb,

Why would you want to run a form designed as a subform?

The subform runs within the parent form when the parent form is run - automatically.

Maybe I've missed something, can you explain in more detail pls?

Kind regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
The form frmCalendar is a pop up form that allows me to enter a date easily in the field.

All I am after is the correct syntax for referring to subforms on forms
 
Hi,

Might help if you say what you want when you ask the question.

You said: if you use the docmd.openform command on a subform you get an error. Well, you always will - that's a good answer to your question.

Why didn't you mention that you wanted to 'refer' to a subform field in your question?

Do you want to 'refer' to a field on a subform in order to populate a field on a subform FROM the Calendar control form?

e.g.

forms!frmMain!frmSubform.form!myfield = me!mycalendar.value

Or would you like me to guess again?

(frmMain & frmSubForm should be replaced with your form names, so should 'mycalendar' be replaced by your Calendar object name).

Kind Regards,

Darrylle


"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top