Subform Trouble

J

JanetF

Hello,

I have a form with a subform, both of which work perfectly. The main form
is a Projects form and is based on a query. The subform is based on a query
as well and is a continuous form which shows all the Tasks per Project. When
users create a new Project record, I want to have a button which allows them
to add a template to the Tasks subform.

I have created a tblTemplate and a frmTemplate which they can access from
the Switchboard and therefore add to/change. Because my subform which I'm
trying to populate has combo box fields in, I have created a query for my
Template form which looks just like the query for the subform, except it uses
the template table instead of the subform (tblTasks) table.

There will only be the one template, which will have three or four (or more
if they add more from the Switchboard) "default" records that I want them to
be able to plunk into the Tasks subform if they click on the command button
on the main Projects form. What I don't know how to do is populate the
subform with those Template records. I've tried running an append query
which appends the records from the Template table to the Tasks (subform)
table and then requerying the subform, but I keep getting an error message
which says an expression I entered is the wrong data type for one of the
arguments. As far as I can tell the data types are the same for the Template
table and the Tasks (subform) table. I think maybe I have to pass the Id
field from the main form along with my subform fields in the append query,
but I'm not sure how to do that. I hope this makes sense. Any ideas?
Thanks in advance.

Janet
 
M

Marshall Barton

JanetF said:
I have a form with a subform, both of which work perfectly. The main form
is a Projects form and is based on a query. The subform is based on a query
as well and is a continuous form which shows all the Tasks per Project. When
users create a new Project record, I want to have a button which allows them
to add a template to the Tasks subform.

I have created a tblTemplate and a frmTemplate which they can access from
the Switchboard and therefore add to/change. Because my subform which I'm
trying to populate has combo box fields in, I have created a query for my
Template form which looks just like the query for the subform, except it uses
the template table instead of the subform (tblTasks) table.

There will only be the one template, which will have three or four (or more
if they add more from the Switchboard) "default" records that I want them to
be able to plunk into the Tasks subform if they click on the command button
on the main Projects form. What I don't know how to do is populate the
subform with those Template records. I've tried running an append query
which appends the records from the Template table to the Tasks (subform)
table and then requerying the subform, but I keep getting an error message
which says an expression I entered is the wrong data type for one of the
arguments. As far as I can tell the data types are the same for the Template
table and the Tasks (subform) table. I think maybe I have to pass the Id
field from the main form along with my subform fields in the append query,
but I'm not sure how to do that. I hope this makes sense. Any ideas?



Just include the main form's ID text box to the append
query. If you need more than that vague generalization,
post a copy of the append query's SQL.
 

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