473,414 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Update Table

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
2 3331
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
2
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
5
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I...
2
by: Miro | last post by:
I will ask the question first then fumble thru trying to explain myself so i dont waste too much of your time. Question / Statement - Every mdb table needs a PrimaryKey ( or maybe an index - i...
1
by: adithi | last post by:
My Table Structure is: Table A Table B Table C colA -PK Col B-PK Col C-PK Col B-FK ...
3
by: Michel Esber | last post by:
Hi all, DB2 V8 LUW FP 15 There is a table T (ID varchar (24), ABC timestamp). ID is PK. Our application needs to frequently update T with a new value for ABC. update T set ABC=? where ID...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.