Search Form Saving Data into Form
Posted on 2015-02-04
I have a form that contains a
Main Form and SubForm
I have a Search Form open up to search for some misc Data and then that Search form Hides the Form above with main and sub, They search and then the button I have does the below opertion.
What is happening is the record is being saved on the subform. I don't want the record saved after the controls are filled in when it returns to the Form. More fields need to be filled in first before finishing the record.
The fields being filled in are on the subform so, I don't know what I am doing wrong.
Maybe I need to set the focus on the subform before going to the search form?
Private Sub Command37_Click()
Forms!frmLicenseSearch2!frmLicenseSearchSub2.Form!Company = Me.Company
Forms!frmLicenseSearch2!frmLicenseSearchSub2.Form!Make = Me.Make
Forms!frmLicenseSearch2!frmLicenseSearchSub2.Form!TractorState = Me.TractorState
Forms!frmLicenseSearch2!frmLicenseSearchSub2.Form!TractorPlate = Me.TractorPlate
Forms!frmLicenseSearch2.Visible = True
Private Sub Form_Load()
If CurrentProject.AllForms("frmLicenseSearch2").IsLoaded Then
Forms!frmLicenseSearch2.Visible = False
Me.txtSearch = Forms!frmLicenseSearch2.LicenseNumber
DoCmd.ApplyFilter "", "[LicenseNumber] Like ""*"" & [Forms]![Query3]![txtSearch] & ""*""", ""