473,320 Members | 1,933 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,320 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, 463 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 2190
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.