By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

Copy date fields from one subform to another

P: 9
I have a tabbed form with several subforms on the tabs. The database is an IT problem management database. The first tab has the information for the Failed Component, the thing that originally broke and made everything else go haywire. The Failed Component tab has a subform named fsubFailedComponent with the name of the failed component. FsubFailedComponent contains fsubFCImpact which is a continuous form that has all of the start and end times times for the failed component.
The next tab is for the various User Facing Applicaitions that were impacted by the failure of the Failed Component. It can have several applications, several locations and within the locations several business units. It has a subform named fsubUserFacingApps which is pretty much like fsubFailedComponent. It has the name of the application and a subform, fsubUFAImpact, with the detail info. My boss wants me to add a button to fsubUFAImpact that a user can click which will copy and paste the start and end times from fsubFCImpact tab to fsubUFAImpact, but still make it editable in case the impact started later or ended earlier.

Thanks!!
Nov 28 '06 #1
Share this Question
Share on Google+
5 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
I have a tabbed form with several subforms on the tabs. The database is an IT problem management database. The first tab has the information for the Failed Component, the thing that originally broke and made everything else go haywire.

The Failed Component tab has a subform named fsubFailedComponent with the name of the failed component. FsubFailedComponent contains fsubFCImpact which is a continuous form that has all of the start and end times times for the failed component.

The next tab is for the various User Facing Applicaitions that were impacted by the failure of the Failed Component. It can have several applications, several locations and within the locations several business units.

It has a subform named fsubUserFacingApps which is pretty much like fsubFailedComponent. It has the name of the application and a subform, fsubUFAImpact, with the detail info.

My boss wants me to add a button to fsubUFAImpact that a user can click which will copy and paste the start and end times from fsubFCImpact tab to fsubUFAImpact, but still make it editable in case the impact started later or ended earlier.

Thanks!!
You will need something like the following code. Substitute your Main Form name for [MainFormName] and correct the names of the StartTime and EndTime fields and substitute your command button name for cmdButtonName.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub cmdButtonName_Click()
  3.  
  4.    Me.StartTime = [Forms]![MainFormName]![fsubFailedComponent].Form![fsubFCImpact].Form![StartTime]
  5.    Me.EndTime = [Forms]![MainFormName]![fsubFailedComponent].Form![fsubFCImpact].Form![EndTime]
  6.  
  7. End Sub
  8.  
Nov 28 '06 #2

P: 9
Hi M,

I tried your solution which was similar to what I did before posting and got the same results. It doesn't seem to 'write' the copied dates to the table. I have a field which calculates the duration of the outage, it showed #ERROR when I did it at first, then when I tried your solution, it showed the same result it had when I hard coded my birthday in on a previous try. Then when I closed the form and reopened it on that record, the copied dates were gone. I'll try a requery or refresh and check back here again.

Thanks,

John
Nov 28 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Hi M,

I tried your solution which was similar to what I did before posting and got the same results. It doesn't seem to 'write' the copied dates to the table. I have a field which calculates the duration of the outage, it showed #ERROR when I did it at first, then when I tried your solution, it showed the same result it had when I hard coded my birthday in on a previous try. Then when I closed the form and reopened it on that record, the copied dates were gone. I'll try a requery or refresh and check back here again.

Thanks,

John
John

Have you set the control source of the controls to the appropriate fields?

Mary
Nov 28 '06 #4

P: 9
John

Have you set the control source of the controls to the appropriate fields?

Mary
That was it!! I just noticed that for some reason the fields were unbound! I guess I inadvertantly did that while messing around with it before. Thanks for pointing me in the right direction Mary! It works like a charm now!
Nov 28 '06 #5

MMcCarthy
Expert Mod 10K+
P: 14,534
Reason: chair to keyboard interface malfunction
I've had one of those before.

I sympathise

Mary
Nov 28 '06 #6

Post your reply

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