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

Setting multiple values in Datasheet

Jerry Maiapu
259 100+
Hi, am trying to change all the values for a specific column in a subform (datasheet) from the parent form. (ie Change NO to Yes for all records in datasheet.
The On click event of the button on the main form is as follows:

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtselectall_Click()
  2.      Dim a
  3.      Dim i As Long
  4.      Dim F As Form
  5.      Dim RS As Recordset
  6.  
  7.      ' Get the form and its recordset.
  8.      Set F = Me.qry_Aknowledgement_subform     Set RS = F.RecordsetClone
  9.  
  10.  
  11. If IsNull(Me.[qry_Aknowledgement_subform]!FName) Then
  12. MsgBox "One or more Applicants missing to Aknowledge for this position. Please select another Position", vbQuestion + vbOKOnly, "No Applicant"
  13. Exit Sub
  14. End If
  15. a = MsgBox("You are about to set the applicants shown as Acknowledged. Are you sure", vbExclamation + vbYesNo, "Proceed with aknowledgement?")
  16. If a = vbYes Then
  17. ' Move to the first record in the recordset.
  18.      RS.MoveFirst
  19.  
  20.      ' Enumerate the list of selected records
  21.          Do Until RS.RecordCount = 0
  22.         RS!AckIssu = "Yes"
  23.         Loop
  24.         RS.MoveNext
  25.     Else
  26.     Exit Sub
  27.     End If
  28.     End Sub
However, does not seem to work. Any suggestions.

Subform: qry_Aknowledgement_subform
Datasheet Column: AckIssu

Thanks in advance.
Jerry
Sep 5 '10 #1

✓ answered by Jerry Maiapu

I found the way around myself. Ta
For those interested this is what I did.

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtselectall_Click()
  2.      Dim a
  3.      Dim i As Long
  4.  
  5.      Dim RS As DAO.Recordset 'Create a variable named rst as a DAO Recordset object
  6.      ' Get the form and its recordset.
  7.  
  8.     Set RS = Me.qry_Aknowledgement_subform.Form.RecordsetClone
  9.  
  10. If IsNull(Me.[qry_Aknowledgement_subform]!FName) Then 'name is missing
  11. MsgBox "One or more Applicants missing to Aknowledge for this position. Please select another Position", vbQuestion + vbOKOnly, "No Applicant"
  12. Exit Sub
  13. End If
  14. a = MsgBox("You are about to set the applicants shown as Acknowledged. Are you sure", vbExclamation + vbYesNo, "Proceed with aknowledgement?")
  15. If a = vbYes Then
  16. ' Move to the first record in the recordset.
  17.  
  18.      RS.MoveFirst
  19.           ' Enumerate the list of selected records
  20.          While Not RS.EOF
  21.         RS.Edit
  22.         RS!AckIssu = "Yes"
  23.         RS.Update
  24.          RS.MoveNext
  25.         Wend
  26.     Else
  27.     Exit Sub
  28.     End If
  29.     RS.Close  'Close the recordset object
  30.     Set RS = Nothing 'Clear the variable to nothing
  31.  
  32.     End Sub

1 2422
Jerry Maiapu
259 100+
I found the way around myself. Ta
For those interested this is what I did.

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtselectall_Click()
  2.      Dim a
  3.      Dim i As Long
  4.  
  5.      Dim RS As DAO.Recordset 'Create a variable named rst as a DAO Recordset object
  6.      ' Get the form and its recordset.
  7.  
  8.     Set RS = Me.qry_Aknowledgement_subform.Form.RecordsetClone
  9.  
  10. If IsNull(Me.[qry_Aknowledgement_subform]!FName) Then 'name is missing
  11. MsgBox "One or more Applicants missing to Aknowledge for this position. Please select another Position", vbQuestion + vbOKOnly, "No Applicant"
  12. Exit Sub
  13. End If
  14. a = MsgBox("You are about to set the applicants shown as Acknowledged. Are you sure", vbExclamation + vbYesNo, "Proceed with aknowledgement?")
  15. If a = vbYes Then
  16. ' Move to the first record in the recordset.
  17.  
  18.      RS.MoveFirst
  19.           ' Enumerate the list of selected records
  20.          While Not RS.EOF
  21.         RS.Edit
  22.         RS!AckIssu = "Yes"
  23.         RS.Update
  24.          RS.MoveNext
  25.         Wend
  26.     Else
  27.     Exit Sub
  28.     End If
  29.     RS.Close  'Close the recordset object
  30.     Set RS = Nothing 'Clear the variable to nothing
  31.  
  32.     End Sub
Sep 5 '10 #2

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

Similar topics

3
by: Henri Schomaecker | last post by:
Hi folks, does php 5 have a problem with html select lists which allow to choose multiple items? Whatever I tried I just can't get another or more than the last item selected in the list....
17
by: Roland Hall | last post by:
Is there a way to return multiple values from a function without using an array? Would a dictionary object work better? -- Roland Hall /* This information is distributed in the hope that it...
5
by: Homer Simpson | last post by:
Hi All, I'm trying to write a method where I pass three arguments and the method returns six values. All the values will be doubles. First, is it possible to get multiple values returned by a...
16
by: Nikolay Petrov | last post by:
How can I return multiple values from a custom function? TIA
9
by: Karl O. Pinc | last post by:
I want to return multiple values, but not a set, only a single row, from a plpgsql function and I can't seem to get it to work. (I suppose I'd be happy to return a set, but I can't seem to make...
0
by: RKT | last post by:
I have a DataGridView bound to an MS Access table. This is a single- user application. When the User is adding or editing a row, the User may click on a Control elsewhere. That Control has context...
1
by: wendy184 | last post by:
I'm used to using 2007 which allows multiple values in the lookup wizard, this helps hugely with my queries as the database i'm building has information on one parent who may have up to 5 kids. ...
2
ADezii
by: ADezii | last post by:
The incentive for this Tip was an Article by the amazing Allen Browne - I considered it noteworthy enough to post as The Tip of the Week in this Access Forum. Original Article by Allen Browne ...
2
by: satyanarayan sahoo | last post by:
Can we write a method which returns multiple values?
0
by: Maric Michaud | last post by:
Le Thursday 28 August 2008 03:43:16 norseman, vous avez écrit : Disctionaries are hash tables with a unique key and constant time lookup. What you want could be implemented as a complex data...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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,...

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.