Hello,
I'm fairly new to Access and programming and this is my first post. I hope I'm in the right category.
I have a form "procedures" with a subform "study programmes". Each "procedure" can include multiple "study programmes" (there is a one-to-many relationship between the tables, this works fine)
Periodically, certain fields (lets say fields X, Y and Z) in each "study programme" record need to be updated. Instead of having to manually update fields X, Y and Z for each study programme in the procedure, I want to just update one study programme and then have a button in the subform that will allow me to copy the contents of fields X, Y and Z to all other study programmes in the procedure.
Based on what I've read it seems like the best solution might be to create a DAO recordset consisting of only the study programmes in this procedure, however, I have never done this before and am not sure where to start. The other option I was thinking about was to move to the next record and copy the data while the procedure ID is the same:
Private Sub bttn_daten_uebernehmen_Click()
Dim verfid As Integer
Dim data As String
procid = Me.id_procedure
data = Me.report_date_ar
While Me.id_procedure = procid
DoCmd.GoToRecord , , acNext
Me.report_date_ar = data
Wend
End Sub
I placed the button for this in the subform. I succeeded in copying the data to the other study programmes in the procedure, however, the code started creating an endless number of new study programme records within the procedure, so this clearly is not the solution. Also, I need to copy the values of 10-25 fields and it seems like creating a variable for each is not the most efficient method. I feel like there must be a much better approach, would greatly appreciate any help!
I'm fairly new to Access and programming and this is my first post. I hope I'm in the right category.
I have a form "procedures" with a subform "study programmes". Each "procedure" can include multiple "study programmes" (there is a one-to-many relationship between the tables, this works fine)
Periodically, certain fields (lets say fields X, Y and Z) in each "study programme" record need to be updated. Instead of having to manually update fields X, Y and Z for each study programme in the procedure, I want to just update one study programme and then have a button in the subform that will allow me to copy the contents of fields X, Y and Z to all other study programmes in the procedure.
Based on what I've read it seems like the best solution might be to create a DAO recordset consisting of only the study programmes in this procedure, however, I have never done this before and am not sure where to start. The other option I was thinking about was to move to the next record and copy the data while the procedure ID is the same:
Private Sub bttn_daten_uebernehmen_Click()
Dim verfid As Integer
Dim data As String
procid = Me.id_procedure
data = Me.report_date_ar
While Me.id_procedure = procid
DoCmd.GoToRecord , , acNext
Me.report_date_ar = data
Wend
End Sub
I placed the button for this in the subform. I succeeded in copying the data to the other study programmes in the procedure, however, the code started creating an endless number of new study programme records within the procedure, so this clearly is not the solution. Also, I need to copy the values of 10-25 fields and it seems like creating a variable for each is not the most efficient method. I feel like there must be a much better approach, would greatly appreciate any help!