Adding new records to a Subform

J

JanetF

Hello,

I have a complicated issue. 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. Any ideas? I hope this makes sense.
Thanks in advance.

Janet
 
J

John Vinson

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. Any ideas? I hope this makes sense.
Thanks in advance.

Do you have any Lookup fields defined in the Tasks table (or the
Template table, either one)? If so, you may have fallen victim to one
of the major downsides of Lookup fields: what you SEE is not what's in
the table. A Lookup field actually *contains* a numeric ID; if you're
trying to append a name (for example - any looked-up value) you'll get
this error.

If that's not it, please post the SQL view of the Append query you're
using, and indicate the datatypes of the source and target tables. One
of them is evidently wrong!

John W. Vinson[MVP]
 

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