473,396 Members | 2,033 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,396 software developers and data experts.

MsAccess Update query command in Form not updating all fields

Ed
If I run my Update query on its own it does the job but if I run the
same query in a Form it does nothing. Can any one tell me what I'm do
wrong; below the type of code I have tried

Example1
Dim db As Database
Dim qd As QueryDef

Set db = CurrentDb
Set qd = db.QueryDefs("Update_Mat_Class_2005")
qd.Execute

Set qd = Nothing
Set qd = Nothing

Example2
DoCmd.SetWarnings False
DoCmd.OpenQuery "Update_Mat_Class_2005"
DoCmd.SetWarnings True

below the query
UPDATE mattemp INNER JOIN mat_class_2005 ON mattemp.euro_code =
mat_class_2005.euro_code SET mat_class_2005.subsector_ =
[mattemp].[subsector_], mat_class_2005.subsector =
[mattemp].[subsector], mat_class_2005.ho_brand = [mattemp].[ho_brand],
mat_class_2005.ho_brand_c = [mattemp].[ho_brand_c],
mat_class_2005.local_brand_c = [mattemp].[local_brand_c],
mat_class_2005.local_brand = [mattemp].[local_brand],
mat_class_2005.brand_vari_c = [mattemp].[brand_vari_c],
mat_class_2005.brand_variant = [mattemp].[brand_variant],
mat_class_2005.packtype_c = [mattemp].[packtype_c],
mat_class_2005.packtype = [mattemp].[packtype],
mat_class_2005.variety_c = [mattemp].[variety_c],
mat_class_2005.variety = [mattemp].[variety], mat_class_2005.portions
= [mattemp].[portions], mat_class_2005.size = [mattemp].[size],
mat_class_2005.uom_code = [mattemp].[uom_code], mat_class_2005.uom =
[mattemp].[uom], mat_class_2005.changed = Yes;

Table Mattemp is used to maintain one specific record that was copied
from table "mat_class_2005"
Isuue is that the only the last field "mat_class_2005.changed" is
updated.
Nov 13 '05 #1
2 5720
Ed wrote:
If I run my Update query on its own it does the job but if I run the
same query in a Form it does nothing. Can any one tell me what I'm do
wrong; below the type of code I have tried Table Mattemp is used to maintain one specific record that was copied
from table "mat_class_2005"
Isuue is that the only the last field "mat_class_2005.changed" is
updated.


For example 1, try
currentdb.execute "Update_Mat_Class_2005", dbfailonerror

It will tell you what error occurs, if any.

For example 2, you could omit the setwarnings false for the same result.

I'd say, if it runs standalone, the query itself is correct.

Are you sure, though, that the fields actually aren't changed? The form
will not refresh automatically; you could put a me.recalc in the code
after you execute the query.
Nov 13 '05 #2
Hi

Thanks for the suggestions Tried them all but none gives a solution as I
do not get errors and it only works when I position it under Form On
close event as a Macro.
No errors occur and tried several other places but the query really
updates only on "Form On close" event

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MVA | last post by:
Hi all I have a database where in a table (tbl_Members), there are 2 date fields (DateOfBirth and DateJoined), and also 2 fields which upon entering the data in the form, it automatically works...
4
by: Reney | last post by:
I have a very weird problem in updating my datagrid. Please help me to solve it. The datagrid is tied to a dataset table with five columns. Three of them are primary key and the other two columns...
6
by: Bernie Hunt | last post by:
I have a simple app that grabs records from a database and steps through them processing each record. I have three text fields on the form to give the user feedback on the progress. With each...
2
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the...
15
by: Scotty | last post by:
I like to have a good insert, update and delete code The code below sometimes workl ok sometimes doesnt work, what i am doing wrong?? Sub SaveAny() Dim command_builder As New...
16
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for...
3
by: Icemokka | last post by:
Hi, I've got a table in MsAccess with 100+ fields. If I fill a tabletable with this table , change some values , get the update-command via commandbuilder , the update fails. This because the...
11
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know...
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.