How do I refer to a subform in visual basic?

M

Mandorallin

I don't know how to refer to a subform when coding using visual basic. I know
refering to a form requires "Forms!" but I need to know how to refer to a
subform
 
M

Mandorallin

Thankyou for the website but I really am an amature at this, I haven't got a
clue what that page is talking about. I just want to know what to type if I
was to refer to a field name in a subform in visual basic. If it were a form
it would be
Forms![FormName].[FieldName] If it is a subform it would be.... what???
 
D

DebbieG

The website is explaining what to type if you refer to a field name in a subform in visual basic.

Let's call the main form frmMain. Let's call the subform subfrmManyRecords. It you want to refer to a field (ControlName) on the
subform (let's call it txtMyField) it would look like this:

Me!subfrmManyRecords.Form!txtMyField

Me! is a way to refer to the form you are coding in instead of having to type Forms!frmMain!.

To use the correct name of the subform, click on the subform object, open the properties box and look at the Name Property, not the
Source Object. They may be the same but you need to make sure. The same applies to the field -- the Name and the Control Source
may not be the same -- you must use whatever is in the Name property.

HTH,
Debbie

| Thankyou for the website but I really am an amature at this, I haven't got a
| clue what that page is talking about. I just want to know what to type if I
| was to refer to a field name in a subform in visual basic. If it were a form
| it would be
| Forms![FormName].[FieldName] If it is a subform it would be.... what???
 

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