Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Add new record based on form query

0 views
Skip to first unread message

granola911 via AccessMonster.com

unread,
Dec 23, 2009, 12:38:20 PM12/23/09
to
Hi All,

I have a form based on a query which pulls from one table, and also has 2
unbound field that gatherd input from the user (qty).

I need to have the values from this form written to a table as a new record.
I have a button which is runs a macro:

Here is what the macro does:
OpenTable ||| TaskLineItems, Add
GoToRecord ||| new
setValue ||| [TaskLineItems]![ChargeCat], [Forms]![f_PullItems_2]!
[Category]
(repeat setValue for all fields)

But I get an error on this "The Object doesn't contain the Automation object
"TaskLineItems".

Can anyone help me with this.

Thanks!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access/200912/1

John W. Vinson

unread,
Dec 23, 2009, 1:15:51 PM12/23/09
to
On Wed, 23 Dec 2009 17:38:20 GMT, "granola911 via AccessMonster.com"
<u56971@uwe> wrote:

>Hi All,
>
>I have a form based on a query which pulls from one table, and also has 2
>unbound field that gatherd input from the user (qty).

An unbound field cannot "gather input". The data must be stored SOMEWHERE.

>I need to have the values from this form written to a table as a new record.
>I have a button which is runs a macro:
>
>Here is what the macro does:
> OpenTable ||| TaskLineItems, Add
> GoToRecord ||| new
> setValue ||| [TaskLineItems]![ChargeCat], [Forms]![f_PullItems_2]!
>[Category]
> (repeat setValue for all fields)
>
>But I get an error on this "The Object doesn't contain the Automation object
>"TaskLineItems".
>
>Can anyone help me with this.
>
>Thanks!

You will basically never need to or want to use the OpenTable action in a
macro. You're going about this the wrong way! What are your tables? How are
they related? What exactly are you trying to accomplish? Would a Form with a
Subform (based on the TaskLineItems table) perhaps meet your needs, without
any macros or code at all?
--

John W. Vinson [MVP]

granola911 via AccessMonster.com

unread,
Dec 23, 2009, 1:27:13 PM12/23/09
to
Actually I often use unbound fields to gather info and pass it to another
form or report and it works perfectly. I've just never tried to use the
setValue for pass data from a form to a table directly.

John W. Vinson wrote:
>>Hi All,
>>
>>I have a form based on a query which pulls from one table, and also has 2
>>unbound field that gatherd input from the user (qty).
>
>An unbound field cannot "gather input". The data must be stored SOMEWHERE.
>
>>I need to have the values from this form written to a table as a new record.
>>I have a button which is runs a macro:

>[quoted text clipped - 12 lines]


>>
>>Thanks!
>
>You will basically never need to or want to use the OpenTable action in a
>macro. You're going about this the wrong way! What are your tables? How are
>they related? What exactly are you trying to accomplish? Would a Form with a
>Subform (based on the TaskLineItems table) perhaps meet your needs, without
>any macros or code at all?

--

granola911 via AccessMonster.com

unread,
Dec 23, 2009, 1:27:24 PM12/23/09
to
Actually I often use unbound fields to gather info and pass it to another
form or report and it works perfectly. I've just never tried to use the
setValue for pass data from a form to a table directly.

John W. Vinson wrote:
>>Hi All,
>>
>>I have a form based on a query which pulls from one table, and also has 2
>>unbound field that gatherd input from the user (qty).
>
>An unbound field cannot "gather input". The data must be stored SOMEWHERE.
>
>>I need to have the values from this form written to a table as a new record.
>>I have a button which is runs a macro:

>[quoted text clipped - 12 lines]
>>

>>Thanks!
>
>You will basically never need to or want to use the OpenTable action in a
>macro. You're going about this the wrong way! What are your tables? How are
>they related? What exactly are you trying to accomplish? Would a Form with a
>Subform (based on the TaskLineItems table) perhaps meet your needs, without
>any macros or code at all?

--

Daryl S

unread,
Dec 23, 2009, 1:54:01 PM12/23/09
to
Granola911 -

The SetValue works on the form, not on a table, so don't bother opening the
table. Also in the SetValue, reference the field on the form (not in the
table). Do that for all fields, and that should work. Remember to save the
record on the form.
--
Daryl S


"granola911 via AccessMonster.com" wrote:

> .
>

granola911 via AccessMonster.com

unread,
Dec 23, 2009, 3:54:06 PM12/23/09
to
Thanks for the input... I was hoping not to have to create intermediate forms
to get the values to the table, but that is what I've done. After trying
everthing I was summizing that the setValue didn't apply to tables.

Thanks again.

Daryl S wrote:
>Granola911 -
>
>The SetValue works on the form, not on a table, so don't bother opening the
>table. Also in the SetValue, reference the field on the form (not in the
>table). Do that for all fields, and that should work. Remember to save the
>record on the form.

>> Hi All,
>>
>[quoted text clipped - 17 lines]
>>
>> Thanks!

--
Message posted via http://www.accessmonster.com

John W. Vinson

unread,
Dec 23, 2009, 5:36:11 PM12/23/09
to
On Wed, 23 Dec 2009 20:54:06 GMT, "granola911 via AccessMonster.com"
<u56971@uwe> wrote:

>Thanks for the input... I was hoping not to have to create intermediate forms
>to get the values to the table, but that is what I've done. After trying
>everthing I was summizing that the setValue didn't apply to tables.

Having the macro run an Append query might be the simplest solution.

0 new messages