471,316 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,316 software developers and data experts.

Copy date fields from one subform to another

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
5 2442
MMcCarthy
14,534 Expert Mod 8TB
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
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
14,534 Expert Mod 8TB
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
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
14,534 Expert Mod 8TB
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.

Similar topics

3 posts views Thread by david | last post: by
9 posts views Thread by David Rysdam | last post: by
1 post views Thread by Stephen D Cook | last post: by
reply views Thread by rosydwin | last post: by

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.