473,387 Members | 1,463 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,387 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 3329
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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,...

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.