military donut
asked on
Search Form Saving Data into Form
Hello,
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!fr mLicenseSe archSub2.F orm!Compan y = Me.Company
Forms!frmLicenseSearch2!fr mLicenseSe archSub2.F orm!Make = Me.Make
Forms!frmLicenseSearch2!fr mLicenseSe archSub2.F orm!Tracto rState = Me.TractorState
Forms!frmLicenseSearch2!fr mLicenseSe archSub2.F orm!Tracto rPlate = Me.TractorPlate
DoCmd.Close
Forms!frmLicenseSearch2.Vi sible = True
End Sub
Private Sub Form_Load()
If CurrentProject.AllForms("f rmLicenseS earch2").I sLoaded Then
Forms!frmLicenseSearch2.Vi sible = False
Me.txtSearch.SetFocus
Me.txtSearch = Forms!frmLicenseSearch2.Li censeNumbe r
DoCmd.ApplyFilter "", "[LicenseNumber] Like ""*"" & [Forms]![Query3]![txtSearc h] & ""*""", ""
End If
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!fr
Forms!frmLicenseSearch2!fr
Forms!frmLicenseSearch2!fr
Forms!frmLicenseSearch2!fr
DoCmd.Close
Forms!frmLicenseSearch2.Vi
End Sub
Private Sub Form_Load()
If CurrentProject.AllForms("f
Forms!frmLicenseSearch2.Vi
Me.txtSearch.SetFocus
Me.txtSearch = Forms!frmLicenseSearch2.Li
DoCmd.ApplyFilter "", "[LicenseNumber] Like ""*"" & [Forms]![Query3]![txtSearc
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That sounds right.
/gustav
/gustav
ASKER