Update all records at once (1 Viewer)

Safari

Member
Local time
Today, 07:50
Joined
Jun 14, 2021
Messages
95
Hi All

How can I update all records in table at once ?

I made update query but its only update one record only .

I want to update all at once


What's steps ?

Thanks
 

conception_native_0123

Well-known member
Local time
Today, 00:50
Joined
Mar 13, 2021
Messages
1,834
may I suggest a good book on how access works? that might help you along. or just SQL. that might work too. it seems that you probably have a WHERE clause in your statement if the query if updating only certain records.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:50
Joined
Feb 28, 2001
Messages
27,172
An UPDATE query ALWAYS updates as many records in a table as are selected or implied or condoned by the combination of the named table (UPDATE tblname SET ...) and the WHERE clauses that filter the table's records according to field contents. If you only updated one record then you must have specified WHERE-clause filters that left you only one record. OR there was only one record in the table, though from your comments, that doesn't seem as likely.

To know exactly what you did / how you did that, could you show us your query? Open it in SQL view, highlight it, copy it, then start a new post in this thread and paste it in place.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 06:50
Joined
Feb 19, 2013
Messages
16,607
what is the sql to your update query? Might be a where clause, might be a join causing only 1 record to be updated
 

Safari

Member
Local time
Today, 07:50
Joined
Jun 14, 2021
Messages
95
hi all

i want to help me updating my query to update all records at once not only one record .. i attached my data base to check and update query name is // updateStoretransaction //

thanks
 

Attachments

  • test.accdb
    3.8 MB · Views: 87

Ranman256

Well-known member
Local time
Today, 01:50
Joined
Apr 9, 2015
Messages
4,337
you are updating records via [invoiceid] #.
the only value is 1.
The form shows value 2 as the default [invoiceid] , so nothing will update for 2.
 

Safari

Member
Local time
Today, 07:50
Joined
Jun 14, 2021
Messages
95
Forms show value 2 when I need new record not current
 

Safari

Member
Local time
Today, 07:50
Joined
Jun 14, 2021
Messages
95
hi all

i want to help me updating my query to update all records at once not only one record .. i attached my data base to check and update query name is // updateStoretransaction //

thanks
 

Attachments

  • test.accdb
    3.8 MB · Views: 90

June7

AWF VIP
Local time
Yesterday, 21:50
Joined
Mar 9, 2014
Messages
5,470
If you want to update every record, don't use filter criteria.

Could run SQL action statement in VBA with CurrentDb.Execute
 

Safari

Member
Local time
Today, 07:50
Joined
Jun 14, 2021
Messages
95
how can i do it ..
iam not good in vba
can you provide me
 

June7

AWF VIP
Local time
Yesterday, 21:50
Joined
Mar 9, 2014
Messages
5,470
Why would you want to update all records with same data such as quantity?

I suggest you do some research on how to construct SQL statements in VBA.

Or try this criteria in your query: LIKE Nz([Forms]![invoicehead]![invoiceid], "*")
 
Last edited:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 06:50
Joined
Jul 9, 2003
Messages
16,280
This is a repost of a similar question, which is still on going Here:-

 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 06:50
Joined
Jul 9, 2003
Messages
16,280
This post has been reposted here:-

 

Safari

Member
Local time
Today, 07:50
Joined
Jun 14, 2021
Messages
95
This is a repost of a similar question, which is still on going Here:-



yes .. but problem still not solved
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:50
Joined
May 7, 2009
Messages
19,233
check if this is what you want.
see the code on the subform's AfterUpdate event.
 

Attachments

  • test (4).accdb
    1.5 MB · Views: 83

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:50
Joined
Feb 28, 2001
Messages
27,172
In your query named updateStoretransaction, if you switch it to SQL view, you have the following:

Code:
WHERE (((StoreTransaction.invoiceid)=[Forms]![invoicehead]![invoiceid]));

This will force your update query to update only one record at a time. In the body of the query, you have elements like this:

Code:
UPDATE StoreTransaction SET StoreTransaction.itemstoreid = [Forms]![invoicehead]![invdetails Subform]![itemname], 
StoreTransaction.unit = [Forms]![invoicehead]![invdetails Subform]![unit], 
...

This implies that you have only one record at a time on the form where you are gathering data. I would say this single-record update behavior is absolutely correct behavior for the combination of the query that you have used and the data sources you are employing. From this particular form, you do NOT want to update all records at once. It will contain only one record's worth of data. There is no justification for making it store data in more than one record at a time.

You insist that the problem is not solved yet. Therefore, we are looking at one of two things happening here. Either

(a) you do not understand some project that you have inherited from someone else or

(b) your description of "not updating every record" doesn't mean to you what it sounds like it means to us, which would imply a language barrier issue.

I am not going to make assumptions either way, but I will categorically state that the problem AS YOU HAVE DESCRIBED IT is totally not possible to fix at any level. The code is not broken.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:50
Joined
Feb 28, 2001
Messages
27,172
You opened another thread for this same question. Since you are new, I will simply note the fact that you now have an answer in another thread. However, for future reference, it is perfectly OK to continue a thread. Adding a new post to a thread has the same effect as adding a new thread. In either case, the post makes it to the top of the "New posts" list. You are new and this is a "site etiquette" issue so you can be forgiven.
 

Users who are viewing this thread

Top Bottom