Automate date in Forms to date in Subform

jsonne

New Member
Joined
May 6, 2004
Messages
40
:oops: Don't understand programming..............

I have a Form (called Contacts) and in that form are two labels "First Call Date" and "Next Call Date". There is also a Subform (called Call Listing Subform) with 3 columns "Call Date", "Call Time' and "Subject". The problem is that the "Call Date" in the Subform is currently giving me whatever today's date is and I don't know how to change it to reflect the "First Call Date" and/or the "Next Call Date". This is the code that is in the Calls form (which is in the Contacts form):

Option Compare Database


Private Sub Form_Open(Cancel As Integer)
If Not IsLoaded("Contacts") Then
MsgBox "Open the Calls form using the Calls button on the Contacts form."
Cancel = True
End If
End Sub
Private Sub Form_Activate()
On Error GoTo Err_Form_Activate
Me.Requery

Exit_Form_Activate:
Exit Sub

Err_Form_Activate:
MsgBox Err.Description
Resume Exit_Form_Activate
End Sub
Private Sub Call_Details_Subform_Enter()
If IsNull(Me![CallID]) Then
Me![Call Listing Subform].Form![CallDate] = Date
DoCmd.GoToControl "Call Listing Subform"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.GoToControl "Call Details Subform"
End If
End Sub

Thanks for any and all help.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hi, this is the line is question...

Me![Call Listing Subform].Form![CallDate] = Date

You need to change that to

Me![Call Listing Subform].Form![CallDate] = [First Call Date]

or

Me![Call Listing Subform].Form![CallDate] = [Next Call Date]

HTH
Denis
 
Upvote 0
:cry: I went to the Call Listing Subform and changed the code to reflect [Next Call Date] and it still won't update! Do I need change something else? Also can I have it do both? First and Next Call Date? Can't figure out what I am doing wrong. Just remember this is all greek to me. Thanks again.
 
Upvote 0
I had another thought -- you need to do this in the subform, not the main form. So, in the subform, put this into the Current event:
Code:
If Me.NewRecord Then
    [MyFieldInTheSubform]=Me.Parent![MyFieldInTheMainForm]
End If
Denis
 
Upvote 0

Forum statistics

Threads
1,221,707
Messages
6,161,416
Members
451,705
Latest member
Priti_190

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top