I have a project with multiple tables with varying data but common to them all is a date field. The date field value can vary but generally is the same.
At times i run a process to create a duplicate of the entire record so that I can produce another scenario for the customer. In most cases this scenario is identical, initially to the original except that the date needs to be changed. At the moment we have to work through the various sub forms that comprise the client scenario and change all the dates to the new one where necessary. This is time consuming and I would like to be able to replace the manual activity with a command button that after inserting the new date in the [StartMonth] will change the dates in all records.
The above code works OK when the change is to a single date field on a form but I have instances where there is a subform with multiple records ie the loans table contains many loans for the one client and I need to change the date on each loan.
I tried the line shown below in the above process and it changed the first record only.
Can anyone advise me how to modify the code to pick up each record in an individual table or query and change the date.
Thanks for your help.
At times i run a process to create a duplicate of the entire record so that I can produce another scenario for the customer. In most cases this scenario is identical, initially to the original except that the date needs to be changed. At the moment we have to work through the various sub forms that comprise the client scenario and change all the dates to the new one where necessary. This is time consuming and I would like to be able to replace the manual activity with a command button that after inserting the new date in the [StartMonth] will change the dates in all records.
Code:
Private Sub Command451_Click()
On Error GoTo Err_Command451_Click
[IncomeTbl Query].Form![StartDate] = [StartMonth]
[Assets Tabbed Form].Form![Residences Query].Form![StartMonth] = [StartMonth]
[Assets Tabbed Form].Form![Cash/Super Investments Query].Form![StartMonth] = [StartMonth]
[Assets Tabbed Form].Form![Investments Portfolio].Form![StartMonth] = [StartMonth]
[Assets Tabbed Form].Form![Properties Query].Form![StartMonth] = [StartMonth]
[Assets Tabbed Form].Form![assetTblOtherAssets].Form![StartMonth] = [StartMonth]
Exit_Command451_Click:
Exit Sub
Err_Command451_Click:
MsgBox Err.Description
Resume Exit_Command451_Click
End Sub
The above code works OK when the change is to a single date field on a form but I have instances where there is a subform with multiple records ie the loans table contains many loans for the one client and I need to change the date on each loan.
I tried the line shown below in the above process and it changed the first record only.
Code:
Forms![NewLoansInputFRm]![StartDate] = [StartMonth]
Can anyone advise me how to modify the code to pick up each record in an individual table or query and change the date.
Thanks for your help.