sub form help

amna77

Active Member
Joined
May 9, 2002
Messages
251
Hi I am trying to save values in my sub form. actually on mu sub form i am keeping the date. when ever user enter date in the main form it gets in to subform date. thats what i want.
Forms!frmCMMDataEntry!Form1!Date = Me.Date
but the thing is when i add new record on main form, then sub form values does not save. i tried to add codes on the main form add new record button.

DoCmd.GoToRecord , , acNewRec
DoCmd.Save acForm, "Form1"
but it gives me error. anyidea whats wrong.
thanks
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I am not too familiar with MS Access macros, however the principle is that if you wish to keep values in a form you need to Hide it rather than close it.

So in a code module I might put something like this to hide Form2 and show Form1. There would be simlar code in Form1 to do the reverse.
Hope this helps.
Code:
'- in Form2
Private Sub Command1_Click()
    Me.Visible = False
    Forms("form1").Visible = True ' needs to be open already
End Sub
 
Upvote 0

Forum statistics

Threads
1,221,825
Messages
6,162,166
Members
451,750
Latest member
dofrancis

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