By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,824 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,824 IT Pros & Developers. It's quick & easy.

Update Table

P: n/a
I read a previous posting and have tried to use it in my database to
update a table called transaction table, but am having problems with
it.

I have pasted the following into the after event procedure

Private Sub Qty_Delivered_AfterUpdate()

CurrentDb.Execute "UPDATE [Transaction Table] set[delivered] = " &
Me.Qty_Delivered.Value
dbfailonerror

End Sub

It comes back with a compile error sub or function not found.

I am new to vba and am trying to learn as I go along, i wonder if you
could please explain why this will not work.

Apr 28 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
feeman wrote:
I read a previous posting and have tried to use it in my database to
update a table called transaction table, but am having problems with
it.

I have pasted the following into the after event procedure

Private Sub Qty_Delivered_AfterUpdate()

CurrentDb.Execute "UPDATE [Transaction Table] set[delivered] = " &
Me.Qty_Delivered.Value
dbfailonerror

End Sub

It comes back with a compile error sub or function not found.

I am new to vba and am trying to learn as I go along, i wonder if you
could please explain why this will not work.
My guess is the update query ran, but the next line was the one
highlighted when the error occurred? This is because dbfailonerror is a
parameter of the CurrentDB statement. As such it belongs in the statement.

Put this all on one line:

CurrentDb.Execute "UPDATE [Transaction Table] set[delivered] = " &
Me.Qty_Delivered.Value, dbfailonerror
--
Smartin
Apr 28 '07 #2

P: n/a
On 28 Apr 2007 15:29:19 -0700, feeman wrote:
I read a previous posting and have tried to use it in my database to
update a table called transaction table, but am having problems with
it.

I have pasted the following into the after event procedure

Private Sub Qty_Delivered_AfterUpdate()

CurrentDb.Execute "UPDATE [Transaction Table] set[delivered] = " &
Me.Qty_Delivered.Value
dbfailonerror

End Sub

It comes back with a compile error sub or function not found.

I am new to vba and am trying to learn as I go along, i wonder if you
could please explain why this will not work.
1) You are missing a space between Set and [Delivered].
Set[Delivered] is not the same as Set [Delivered].

2) Value is the default control property, so you do not need to
expressly state it.

3) You need a comma after the Execute statement if you are going to
use the dbFailOnError argument.

4) If [Delivered] is a Number datatype field, use:

CurrentDb.Execute "UPDATE [Transaction Table] set [Transaction
Table].[delivered] = " & Me.Qty_Delivered, dbfailonerror

If [Delivered' is a Text datatype, then useL:

CurrentDb.Execute "UPDATE [Transaction Table] set [Transaction
Table].[delivered] = '" & Me.Qty_Delivered & "'", dbfailonerror

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Apr 29 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.