Access does not recognize "sbfrmItems" as a valid object (i.e. subform) on
your form and therefore thinks it is an undeclared variable. Check & recheck
the spelling. Try this:
Go to design view of your form.
Right-click on the upper right-hand corner of the subform.
Click Properties.
Click the "Other" tab.
Copy the subform name & paste it here:
I just want to make sure it is exactly the same. I am not aware of any
alternative way to refer to the subform. I just posted this question in the
same forum. Give it a couple of hours, and search this forum for "Subform
reference". If the spelling is indeed exact, maybe someone else knows some
trick that is needed to get the correct reference. I am using Access 2003,
and perhaps something was different in Access 2000.
> Ok. I inserted and I compiled, and I received the following error:
>
[quoted text clipped - 123 lines]
> > > > > > >
> > > > > > > Thanks in advance!
well I checked the properties>other>name of the subform on the Form and it
turns out the name there was 'items subform', even though the actual name of
the subform itself is 'sbfrmItems'. I don't know how that could be possible,
since the Form showed the subform correctly using the wrong name? Anyway, I
changed the properties>other>name to 'sbfrmItems' and that solved the issue
using Me.sbfrmItems.Locked = True.
Thanks again a million for your help!
Quick question since you said you are using 2003, would it be better to
migrate this 2000 db to 2003?
> Access does not recognize "sbfrmItems" as a valid object (i.e. subform) on
> your form and therefore thinks it is an undeclared variable. Check & recheck
[quoted text clipped - 140 lines]
> > > > > > > >
> > > > > > > > Thanks in advance!
Brian - 04 Aug 2005 18:56 GMT
I don't think there is any pressing reason to migrate. I upgraded only
because I needed to get the developer tools (for distributing the runtime)
and thought I might as well get to the 2003 version so that I wouldn't have
to upgrade for a while. There were also some quirks (i.e. bugs) with the SP3
release for Access 2002 (which is what I had before), and I did not want to
go back to 2000.
> well I checked the properties>other>name of the subform on the Form and it
> turns out the name there was 'items subform', even though the actual name of
[quoted text clipped - 152 lines]
> > > > > > > > >
> > > > > > > > > Thanks in advance!
Katayon - 04 Aug 2005 19:15 GMT
Ok cool. Thanks again for all your help!
> I don't think there is any pressing reason to migrate. I upgraded only
> because I needed to get the developer tools (for distributing the runtime)
[quoted text clipped - 159 lines]
> > > > > > > > > >
> > > > > > > > > > Thanks in advance!
Brian - 04 Aug 2005 19:13 GMT
The name of the subform as it exists on the form is completely independent of
the name of the subform as you open/edit it directly as a form itself.
There are two properties of the subform that relate to the name:
Data -> SourceObject: the name of the true subform
Other -> Name: the reference to the subform as it exists on the main form
When going through the subform wizard that pops up when you add a subform to
your form:
If you use an existing form (i.e. create the subform alone, then add it to
the main form), it retains the name of the form as both the source objectg
and the form name. If, on the other hand, you build the subform from a table
in the wizard, it names it like this:
"<Table1> name subform"
Let me guess: your table is named "Items"...
> well I checked the properties>other>name of the subform on the Form and it
> turns out the name there was 'items subform', even though the actual name of
[quoted text clipped - 152 lines]
> > > > > > > > >
> > > > > > > > > Thanks in advance!