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

update multi records on the subform

16
I have “animal_sales_main” as a main form and “animal_sales_detials Subform” as a subform contain one record or many records, the control object in the animal_sales_detials Subform it is field “ animal_id”
And I have a table named “animals” has fields “ animal_id” , “ status” .....etc

The target is :
When I add any records in field “animal_id” on the subform “ animal_sales_detials Subform” and click some button :

All the records in the table “animals” that have the same “animal_id “ in the subform will update the “Status” field by word “sold”
?

please, to see the attached picture

Regards
Attached Images
File Type: jpg Untitled.jpg (52.1 KB, 468 views)
Jul 26 '15 #1

✓ answered by Seth Schrock

I can't open the picture while at work. However, what I would do would be to run an UPDATE query in the After_Update event in your animal_id control.
Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.Database
  2. Dim strUpdate As String
  3.  
  4. strUpdate = "UPDATE [Proper_Table_Name] SET Status = 'Sold' " & _
  5.             "WHERE animal_id = " & Me.animal_id
  6.  
  7. Set db = CurrentDb
  8. db.Execute strUpdate, dbFailOnError
  9.  
  10. Set db = Nothing

2 2196
Seth Schrock
2,965 Expert 2GB
I can't open the picture while at work. However, what I would do would be to run an UPDATE query in the After_Update event in your animal_id control.
Expand|Select|Wrap|Line Numbers
  1. Dim db As DAO.Database
  2. Dim strUpdate As String
  3.  
  4. strUpdate = "UPDATE [Proper_Table_Name] SET Status = 'Sold' " & _
  5.             "WHERE animal_id = " & Me.animal_id
  6.  
  7. Set db = CurrentDb
  8. db.Execute strUpdate, dbFailOnError
  9.  
  10. Set db = Nothing
Jul 27 '15 #2
SSDA
16
thanks Mr. Seth Schrock for your reply
Jul 28 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Mark S. | last post by:
Hi, I have a weird UPDATE sequence I want to perform. The customer does not want to use INSERT and DELETE. My issue is that there are multiple Mat_Class, but I do not wish to hard code each one...
1
by: Kenneth | last post by:
Dear all, How can I update multiple records in using ASP.NET? Currently I have a table which require to update frequently but I can update records one by one using DataGrid. Kenneth
0
by: rhepsi | last post by:
Dear All, Im vb.net 1.1, When im trying to update the records from mysql to postgresql, the connection error: the following code is Update data button click: Dim myPgrConnect As...
1
by: jllopez | last post by:
I need update multiple records in the datagrid but this is using ASP.net and VB, somebody that I can help?
1
by: hilal84 | last post by:
Hi, I have a problem on updating some records on sql server 2005. I can update the records in the table apart from some records. Records are added to table by a .net application. When I try to...
2
daniel aristidou
by: daniel aristidou | last post by:
Hi can anyone help me with the logic of updating records that are selected in a datagrid. Just wanna be sure before i code it all, since its first time im doing this and making sure the logic is...
1
Fary4u
by: Fary4u | last post by:
how can i update multiple records corresponding to perticular ID & update values in one go ? mode_a contains ID No. Dim mode,mode_a,i mode=Request("t1") mode_a=split(mode,",")
1
by: engrlorie | last post by:
I have four tables in access 2003: T1 (8 fields), t2 (5 fields), t3 (7 fields), t4 (3 fields) all connected to each other with t1.a = t2.a, t1.a=t3.a, t1.a=t4.a (T2, T3 and T4 contains the FK for T1....
2
by: Robin Lewando | last post by:
Hi I have a multi row subform that is populated by the results of a query. The status field (populated by data from the query) in each row may be different. I would like to set any row which has...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.