Private Sub btn_CopyNewCustomer_Click()
' Copying information from f_New_Customer Form using Copy Information Crating New Case Button
' to Customer_Call Form.
Dim well As String
Dim WellLookUp As String
Dim frm As Form
Dim ctl1, ctl2, ctl3, ctl4, ctl5, ctl6 As Control
Dim varResult1, varResult2, varResult3, varResult4, varResult5, varResult6 As Variant
Set frm = Forms!f_New_Customer ' pointing to New Customer form.
Set ctl1 = frm!FirstName ' pointing to First Name.
Set ctl2 = frm!LastName
Set ctl3 = frm!Address
Set ctl4 = frm!City
Set ctl5 = frm!Phone_1
Set ctl6 = frm!WellNbr_Dropdwn
' ============ 6 conditions ==================================
varResult1 = IIf(Nz(ctl1.Value) = vbNullString, _
"No value For First Name", "Value is " & ctl1.Value & ".")
varResult2 = IIf(Nz(ctl2.Value) = vbNullString, _
"No value For Last Name", "Value is " & ctl2.Value & ".")
varResult3 = IIf(Nz(ctl3.Value) = vbNullString, _
"No value For Address", "Value is " & ctl3.Value & ".")
varResult4 = IIf(Nz(ctl4.Value) = vbNullString, _
"No value For City", "Value is " & ctl4.Value & ".")
varResult5 = IIf(Nz(ctl5.Value) = vbNullString, _
"No value For Phone-1", "Value is " & ctl5.Value & ".")
varResult6 = IIf(Nz(ctl6.Value) = vbNullString, _
"No value For Well Number: ", "Value is " & ctl6.Value & ".")
' ============================================================================
' =============== The Message box letting the user know what is blank and what has data ============
MsgBox "First Name: " & varResult1 & vbCrLf & "Last Name: " & varResult2 _
& vbCrLf & "Address: " & varResult3 & vbCrLf & "City : " & varResult4 _
& vbCrLf & "Phone1: " & varResult5 & vbCrLf & "Well Number: " & varResult6, vbExclamation, "Minimum Information Needed"
Exit Sub
' ====================================================================================================
' ============== Code excute if all needed info is there ==============================================
DoCmd.Close acForm, "f_New_Customer", acSaveYes
DoCmd.OpenForm "Customer_Call", acNormal, , , acFormAdd, acWindowNormal
'------- Well Location Address
Forms!Customer_Call.Tbl_First = Forms!f_New_Customer.FirstName
Forms!Customer_Call.Tbl_Last = Forms!f_New_Customer.LastName
Forms!Customer_Call.Tbl_Phone_1 = Forms!f_New_Customer.Phone_1
Forms!Customer_Call.Tbl_Phone_2 = Forms!f_New_Customer.Phone_2
Forms!Customer_Call.Tbl_E_Mail = Forms!f_New_Customer.E_mail
Forms!Customer_Call.streetnumber2 = Forms!f_New_Customer.Address
Forms!Customer_Call.city2 = Forms!f_New_Customer.City
Forms!Customer_Call.state2 = Forms!f_New_Customer.State
Forms!Customer_Call.Tbl_Well_ID = Forms!f_New_Customer.Well_ID
Forms!Customer_Call.Tbl_Zip2 = Forms!f_New_Customer.Zip
'------ Mailing Address
Forms!Customer_Call.streetnumber = Forms!f_New_Customer.W_Address
Forms!Customer_Call.City = Forms!f_New_Customer.W_City
Forms!Customer_Call.State = Forms!f_New_Customer.W_State
Forms!Customer_Call.Tbl_Zip = Forms!f_New_Customer.W_Zip
Forms!Customer_Call.Tbl_Home_Served = Forms!f_New_Customer.Homes_Served
Forms!Customer_Call.CheckGPSFY2012 = Forms!f_New_Customer.chk_sch_GPS
DoCmd.Close acForm, "f_New_Customer", acSaveNo
DoCmd.Close acForm, "f_Customer_Lookup", acSaveYes
DoCmd.OpenForm "Customer_Call"
End Sub