Problem with forms & data entry on database

G

Guest

I have a database set up that has a parent table and child table. I created
a form/subform based on this relationship, and we are having a problem with
it. When the "parent" information is entered, everything is fine, but when
the user moves to the subform, we get the following error message: "An error
occured while referencing the object. You tried to run a Visual Basic
procedure that improperly reference a property or method of an object." This
error message comes up when the user actually clicks on the first field of
the subform to enter data. After that, however, the user is able to input
data and nothing further happens until trying to move back to the parent set
to add another record. At that point, the user is told that the record on
the child set cannot be saved because there is no corresponding record in the
parent field.

We can open the parent table directly and expand the subdatasheet, and enter
information there without problem. So, what have I done with the forms to
cause a problem? Should I start over on the form design? If so, what should
I be sure to pay attention to???
 
W

Wayne Morgan

Have you set the Parent/Child links for the subform? These are set in the
Properties for the subform control on the parent form and should be set to
the two fields you are using in the table relationship. Also, do you have
any code in the subform, such as in the GotFocus or Enter event of the first
control on the subform or the subform control?
 
B

birthwarrior

Yes, I did that. No, did not use any code in setting up the form. I
set up the form using a Wizard, after having initially set up the child
form separately. Might it work better if I start from scratch and
create a form/subform using the wizard, rather than pulling in the form
for the child table and setting it as the subform within the form?

Thanks!

Lisa
 
W

Wayne Morgan

No, creating the forms separately then placing one on the other as a subform
should work fine. Did you drag and drop the subform onto the main form or
did you place a subform control on the main form then set the subform as its
Source Object? Is the Record Source for the subform the table or a query
based on the table?

One other thought would be code on the main form. While there may not be any
code, there may be a type (even a space) in one of the boxes on the Event
tab. If there is no code, they should all be empty except for Key Preview
and Timer Interval. Key Preview should be No and Timer Interval should be 0.
 

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