hello guys i want to get a msgbox to let the user enter the data in specific textboxes so they can't let it empty if not empty then do .......
this is my code
If Me.Client_Name.Value = "" Then
MSG = MsgBox("You Should Enter The Client Name")
ElseIf Me.Username.Value = "" Then
MSG = MsgBox("You Should Enter The UserName")
ElseIf Me.Address.Value = "" Then
MSG = MsgBox("You Should Enter The Address")
ElseIf Me.Registered_Date.Value = "" Then
MSG = MsgBox("You Should Enter The Registered Date")
ElseIf Me.Phone_01.Value = "" Then
MSG = MsgBox("You Should Enter At least One Phone Number")
ElseIf Me.Mobile_01.Value = "" Then
MSG = MsgBox("You Should Enter The At least One Mobile Number")
ElseIf Me.cbo_where_to_pay.Value = "" Then
MSG = MsgBox("You Should Enter The Place To Pay")
ElseIf Me.cbo_zone.Value = "" Then
MSG = MsgBox("You Should Enter The Zone Area")
ElseIf Me.Client_Name <> "" And Me.Username.Value <> "" And Me.Address.Value <> "" And Me.Registered_Date.Value <> "" And Me.Phone_01.Value <> "" And Me.Mobile_01 <> "" And Me.cbo_where_to_pay.Value <> "" And Me.cbo_zone <> "" Then
Answer = MsgBox("Adding New Account" & vbCrLf & _
"" & vbCrLf & _
"Client Name : " & [Client_Name] & vbCrLf & _
"" & vbCrLf & _
"UserName : " & [Username] & vbCrLf & _
"" & vbCrLf & _
"Address : " & [Address] & vbCrLf & _
"" & vbCrLf & _
"Registered Date : " & [Registered_Date] & vbCrLf & _
"" & vbCrLf & _
"Phone Number : " & [Phone_01] & " " & [Phone_02] & vbCrLf & _
"" & vbCrLf & _
"Mobile Number : " & [Mobile_01] & " " & [Mobile_02] & vbCrLf & _
"" & vbCrLf & _
"Place To Pay : " & [cbo_where_to_pay].Column(1) & vbCrLf & _
"" & vbCrLf & _
"Zone Area : " & [cbo_zone].Column(1) & vbCrLf & _
"" & vbCrLf & _
"Click Yes If You Want To Proceed With This Information", vbYesNo + vbQuestion + vbDefaultButton1, "ZedNet - Adding New Client")
If Answer = vbYes Then
strsql101 = "insert into tblPersonalInformation (ClientName, Username, Address, Registered_Date, Phone_01, Phone_02, Mobile_01, Mobile_02, Where_To_Pay, Zone, Email) Values ('" & Me.Client_Name & "','" & Me.Username & "','" & Me.Address & "','" & Me.Registered_Date & "','" & Me.Phone_01 & "','" & Me.Phone_02 & "','" & Me.Mobile_01 & "','" & Me.Mobile_02 & "','" & Me.cbo_where_to_pay.Column(1) & "','" & Me.cbo_zone.Column(1) & "','" & Me.Email & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL strsql101
Me.Client_Name = ""
Me.Username = ""
Me.Address = ""
Me.Registered_Date = ""
Me.Phone_01 = ""
Me.Phone_02 = ""
Me.Mobile_01 = ""
Me.Mobile_02 = ""
Me.cbo_where_to_pay = ""
Me.cbo_zone = ""
AccCreated = MsgBox("New Client was Successfully Created", vbOKOnly + vbInformation, "ZedNet - Adding New Client")
End If
End If
the msgboxes that tell the user this textbox is empty is not appearing what's wrong with my code
this is my code
If Me.Client_Name.Value = "" Then
MSG = MsgBox("You Should Enter The Client Name")
ElseIf Me.Username.Value = "" Then
MSG = MsgBox("You Should Enter The UserName")
ElseIf Me.Address.Value = "" Then
MSG = MsgBox("You Should Enter The Address")
ElseIf Me.Registered_Date.Value = "" Then
MSG = MsgBox("You Should Enter The Registered Date")
ElseIf Me.Phone_01.Value = "" Then
MSG = MsgBox("You Should Enter At least One Phone Number")
ElseIf Me.Mobile_01.Value = "" Then
MSG = MsgBox("You Should Enter The At least One Mobile Number")
ElseIf Me.cbo_where_to_pay.Value = "" Then
MSG = MsgBox("You Should Enter The Place To Pay")
ElseIf Me.cbo_zone.Value = "" Then
MSG = MsgBox("You Should Enter The Zone Area")
ElseIf Me.Client_Name <> "" And Me.Username.Value <> "" And Me.Address.Value <> "" And Me.Registered_Date.Value <> "" And Me.Phone_01.Value <> "" And Me.Mobile_01 <> "" And Me.cbo_where_to_pay.Value <> "" And Me.cbo_zone <> "" Then
Answer = MsgBox("Adding New Account" & vbCrLf & _
"" & vbCrLf & _
"Client Name : " & [Client_Name] & vbCrLf & _
"" & vbCrLf & _
"UserName : " & [Username] & vbCrLf & _
"" & vbCrLf & _
"Address : " & [Address] & vbCrLf & _
"" & vbCrLf & _
"Registered Date : " & [Registered_Date] & vbCrLf & _
"" & vbCrLf & _
"Phone Number : " & [Phone_01] & " " & [Phone_02] & vbCrLf & _
"" & vbCrLf & _
"Mobile Number : " & [Mobile_01] & " " & [Mobile_02] & vbCrLf & _
"" & vbCrLf & _
"Place To Pay : " & [cbo_where_to_pay].Column(1) & vbCrLf & _
"" & vbCrLf & _
"Zone Area : " & [cbo_zone].Column(1) & vbCrLf & _
"" & vbCrLf & _
"Click Yes If You Want To Proceed With This Information", vbYesNo + vbQuestion + vbDefaultButton1, "ZedNet - Adding New Client")
If Answer = vbYes Then
strsql101 = "insert into tblPersonalInformation (ClientName, Username, Address, Registered_Date, Phone_01, Phone_02, Mobile_01, Mobile_02, Where_To_Pay, Zone, Email) Values ('" & Me.Client_Name & "','" & Me.Username & "','" & Me.Address & "','" & Me.Registered_Date & "','" & Me.Phone_01 & "','" & Me.Phone_02 & "','" & Me.Mobile_01 & "','" & Me.Mobile_02 & "','" & Me.cbo_where_to_pay.Column(1) & "','" & Me.cbo_zone.Column(1) & "','" & Me.Email & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL strsql101
Me.Client_Name = ""
Me.Username = ""
Me.Address = ""
Me.Registered_Date = ""
Me.Phone_01 = ""
Me.Phone_02 = ""
Me.Mobile_01 = ""
Me.Mobile_02 = ""
Me.cbo_where_to_pay = ""
Me.cbo_zone = ""
AccCreated = MsgBox("New Client was Successfully Created", vbOKOnly + vbInformation, "ZedNet - Adding New Client")
End If
End If
the msgboxes that tell the user this textbox is empty is not appearing what's wrong with my code