Form and Subform control(s) names

J

Joel Montalvo

Help!!!
I have a piece of shareware code that when you click a
command button, a pop-up Mini Calendar appears. This takes
several functions to accomplish but basically it returns
the date into a textbox on the form. This works fine when
the form is a parent. The problem I am having is that I
made the form into a subform. The pop-up form still
appears, but now I get an error. Form not found. I tried
changing the names of the form(subform) and field but
still either get Form not found or field not found. I have
tried several different ways to name the form, subform and
field without success. Can anyone help???

The command button code:
Call fMiniCalendar(, , "frmMain", "subfAdd_New_Issue!
txtReviewDate")

Where frmMain is the parent form, subfAdd_New_Issue is the
name of the subform/form and the subform control on
frmMain, and txtReviewDate is the text field on the
subform/form subfAdd_New_Issue that the return date value
goes.

The error keeps stoping on this line:
Forms(FormName)(FieldName) = CombinedDate

Where FormName is the name of the form in the first set of
quotes in the original Call statement above, and Fieldname
is the field in the second set of quotes above.
CombinedDate you can ignore that is the value that wil be
returned - that part works.

I know this works when I open subfAdd_New_Issue by itself.
How do I return the value to the field when it is the
subform??? Help!
 
M

MacDermott

Your code probably includes some code including syntax like this:
Forms!MyForm...
(with the name of the form instead of MyForm).
When you use MyForm as a subform, it is no longer a member of the Forms
collection.
If it is displayed in a control named MyControl on a form named MyBigForm,
you can refer to it like this:
Forms!MyBigForm!MyControl.Form

HTH
- Turtle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top