Syntax error help request

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi -

I am receiving a syntax error on the following line of code, and am hoping
somebody more knowledgeable than I can help me define the issue:

If (Me.[Will Prep]) = Don’t Know Yet Or (Me.[Underwriting Requirements]) =
Don’t Know Yet Or (Me.[Logo]) = Don’t Know Yet Or (Me.[Enrollment Materials])
= Don’t Know Yet Or (Me.[Enrollment Method]) = Don’t Know Yet Or (Me.[Online
Experience]) = Don’t Know Yet Or (Me.[Enrollment Recordkeeping]) = Don’t Know
Yet Then
If Msgbox(Msg ,vbYesNo)<>vbYes then
cancel = true
end if
End If

Thanks to anyone out there...and everyone who has helped me in the past as
well!

M
 
It's difficult to be sure without knowing whether those controls are bound
or unbound, and if they are bound, the data types of the fields to which
they are bound. That said, given the information available, my best guess is
that you may just need quotes around "Don't Know Yet", something like ...

If (Me.[Will Prep]) = "Don't Know Yet" Or ... etc.
 
Brendan - Thanks for taking a look at this...I can show you the entire code
which may help you better undertand the issue.

Adding the " " did not work unfortunately...

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyMsg As String
MyMsg = "One or more of the following fields within Case Profile are
incomplete:" & Chr(13) & _
"Sales Alert Date " & Chr(13) & _
"Eligibles " & Chr(13) & _
"Region" & Chr(13) & _
"Case Type" & Chr(13) & _
"Industry" & Chr(13) & _
"Product" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

Dim Msg As String
Msg = "One or more of the following fields within Strategy Sold are
incomplete:" & Chr(13) & _
"Will Prep" & Chr(13) & _
"Underwriting Requirements" & Chr(13) & _
"Logo" & Chr(13) & _
"Enrollment Materials" & Chr(13) & _
"Enrollment Method" & Chr(13) & _
"Online Experience" & Chr(13) & _
"Enrollment Recordkeeping" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

If IsNull(Me.[Sales Alert Date]) Or IsNull(Me.[Eligibles]) Or
IsNull(Me.[Region]) Or IsNull(Me.[Case Type]) Or IsNull(Me.[Industry]) Or
IsNull(Me.[Product]) Then
If MsgBox(MyMsg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

If (Me.[Will Prep]) = "Don't Know Yet" Or (Me.[Underwriting Requirements]) =
"Don't Know Yet" Or (Me.[Logo]) = "Don't Know Yet" Or (Me.[Enrollment
Materials]) = "Don't Know Yet Or" (Me.[Enrollment Method]) = "Don't Know Yet"
Or (Me.[Online Experience]) = "Don't Know Yet" Or (Me.[Enrollment
Recordkeeping]) = "Don't Know Yet" Then
If MsgBox(Msg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

End Sub

Again, thanks
M

Brendan Reynolds said:
It's difficult to be sure without knowing whether those controls are bound
or unbound, and if they are bound, the data types of the fields to which
they are bound. That said, given the information available, my best guess is
that you may just need quotes around "Don't Know Yet", something like ...

If (Me.[Will Prep]) = "Don't Know Yet" Or ... etc.

--
Brendan Reynolds

Monish said:
Hi -

I am receiving a syntax error on the following line of code, and am hoping
somebody more knowledgeable than I can help me define the issue:

If (Me.[Will Prep]) = Don't Know Yet Or (Me.[Underwriting Requirements]) =
Don't Know Yet Or (Me.[Logo]) = Don't Know Yet Or (Me.[Enrollment
Materials])
= Don't Know Yet Or (Me.[Enrollment Method]) = Don't Know Yet Or
(Me.[Online
Experience]) = Don't Know Yet Or (Me.[Enrollment Recordkeeping]) = Don't
Know
Yet Then
If Msgbox(Msg ,vbYesNo)<>vbYes then
cancel = true
end if
End If

Thanks to anyone out there...and everyone who has helped me in the past as
well!

M
 
The second quote in this line is in the wrong place - after the 'Or' when it
should be before it ...

<quote>
Materials]) = "Don't Know Yet Or" (Me.[Enrollment Method]) = "Don't Know
Yet"
</quote>

--
Brendan Reynolds

Monish said:
Brendan - Thanks for taking a look at this...I can show you the entire
code
which may help you better undertand the issue.

Adding the " " did not work unfortunately...

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyMsg As String
MyMsg = "One or more of the following fields within Case Profile are
incomplete:" & Chr(13) & _
"Sales Alert Date " & Chr(13) & _
"Eligibles " & Chr(13) & _
"Region" & Chr(13) & _
"Case Type" & Chr(13) & _
"Industry" & Chr(13) & _
"Product" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

Dim Msg As String
Msg = "One or more of the following fields within Strategy Sold are
incomplete:" & Chr(13) & _
"Will Prep" & Chr(13) & _
"Underwriting Requirements" & Chr(13) & _
"Logo" & Chr(13) & _
"Enrollment Materials" & Chr(13) & _
"Enrollment Method" & Chr(13) & _
"Online Experience" & Chr(13) & _
"Enrollment Recordkeeping" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

If IsNull(Me.[Sales Alert Date]) Or IsNull(Me.[Eligibles]) Or
IsNull(Me.[Region]) Or IsNull(Me.[Case Type]) Or IsNull(Me.[Industry]) Or
IsNull(Me.[Product]) Then
If MsgBox(MyMsg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

If (Me.[Will Prep]) = "Don't Know Yet" Or (Me.[Underwriting Requirements])
=
"Don't Know Yet" Or (Me.[Logo]) = "Don't Know Yet" Or (Me.[Enrollment
Materials]) = "Don't Know Yet Or" (Me.[Enrollment Method]) = "Don't Know
Yet"
Or (Me.[Online Experience]) = "Don't Know Yet" Or (Me.[Enrollment
Recordkeeping]) = "Don't Know Yet" Then
If MsgBox(Msg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

End Sub

Again, thanks
M

Brendan Reynolds said:
It's difficult to be sure without knowing whether those controls are
bound
or unbound, and if they are bound, the data types of the fields to which
they are bound. That said, given the information available, my best guess
is
that you may just need quotes around "Don't Know Yet", something like ...

If (Me.[Will Prep]) = "Don't Know Yet" Or ... etc.

--
Brendan Reynolds

Monish said:
Hi -

I am receiving a syntax error on the following line of code, and am
hoping
somebody more knowledgeable than I can help me define the issue:

If (Me.[Will Prep]) = Don't Know Yet Or (Me.[Underwriting
Requirements]) =
Don't Know Yet Or (Me.[Logo]) = Don't Know Yet Or (Me.[Enrollment
Materials])
= Don't Know Yet Or (Me.[Enrollment Method]) = Don't Know Yet Or
(Me.[Online
Experience]) = Don't Know Yet Or (Me.[Enrollment Recordkeeping]) =
Don't
Know
Yet Then
If Msgbox(Msg ,vbYesNo)<>vbYes then
cancel = true
end if
End If

Thanks to anyone out there...and everyone who has helped me in the past
as
well!

M
 
Private Sub Form_BeforeUpdate(Cancel As Integer)
Cancel = Not ValidateForm()
End Sub

Private Function ValidateForm() As String
'--------------------------------------------
ValidateForm = False
'--------------------------------------------
Dim ErrorMsg As String

ErrorMsg = ValidateControl(Me.[Sales Alert Date])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Eligibles])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Region])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Case Type])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Industry])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Product])

If ErrorMsg <> "" Then
ErrorMsg = "The following fields " & _
"within Case Profile are incomplete:" & Chr(13) & _
ErrorMsg & _
"Would you like to continue anyway?"
If MsgBox(Msg, vbYesNo) <> vbYes Then
Exit Function
End If

End If
'--------------------------------------------
ErrorMsg = ValidateControl(Me.[Will Prep])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Eligibles])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Underwriting Requirements])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Logo])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Enrollment Materials])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Enrollment Method])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Online Experience])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Enrollment Recordkeeping])


If ErrorMsg <> "" Then
ErrorMsg = "The following fields " & _
"within Strategy Sold are incomplete:" & Chr(13) & _
ErrorMsg & _
"Would you like to continue anyway?"
If MsgBox(Msg, vbYesNo) <> vbYes Then
Exit Function
End If

End If
'--------------------------------------------
ValidateForm = True
'--------------------------------------------
End Function

Private Function ValidateControl(InControl As TextBox) As String
'--------------------------------------------
ValidateControl = ""

If IsNull(InControl) Then
ValidateControl = InControl.Name & Chr(13)

ElseIf InControl = "Don't Know Yet" Then
ValidateControl = InControl.Name & Chr(13)

End If
'--------------------------------------------
End Function

Monish said:
Brendan - Thanks for taking a look at this...I can show you the entire code
which may help you better undertand the issue.

Adding the " " did not work unfortunately...

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyMsg As String
MyMsg = "One or more of the following fields within Case Profile are
incomplete:" & Chr(13) & _
"Sales Alert Date " & Chr(13) & _
"Eligibles " & Chr(13) & _
"Region" & Chr(13) & _
"Case Type" & Chr(13) & _
"Industry" & Chr(13) & _
"Product" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

Dim Msg As String
Msg = "One or more of the following fields within Strategy Sold are
incomplete:" & Chr(13) & _
"Will Prep" & Chr(13) & _
"Underwriting Requirements" & Chr(13) & _
"Logo" & Chr(13) & _
"Enrollment Materials" & Chr(13) & _
"Enrollment Method" & Chr(13) & _
"Online Experience" & Chr(13) & _
"Enrollment Recordkeeping" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

If IsNull(Me.[Sales Alert Date]) Or IsNull(Me.[Eligibles]) Or
IsNull(Me.[Region]) Or IsNull(Me.[Case Type]) Or IsNull(Me.[Industry]) Or
IsNull(Me.[Product]) Then
If MsgBox(MyMsg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

If (Me.[Will Prep]) = "Don't Know Yet" Or (Me.[Underwriting Requirements]) =
"Don't Know Yet" Or (Me.[Logo]) = "Don't Know Yet" Or (Me.[Enrollment
Materials]) = "Don't Know Yet Or" (Me.[Enrollment Method]) = "Don't Know Yet"
Or (Me.[Online Experience]) = "Don't Know Yet" Or (Me.[Enrollment
Recordkeeping]) = "Don't Know Yet" Then
If MsgBox(Msg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

End Sub

Again, thanks
M

Brendan Reynolds said:
It's difficult to be sure without knowing whether those controls are bound
or unbound, and if they are bound, the data types of the fields to which
they are bound. That said, given the information available, my best guess is
that you may just need quotes around "Don't Know Yet", something like ....

If (Me.[Will Prep]) = "Don't Know Yet" Or ... etc.

--
Brendan Reynolds

Monish said:
Hi -

I am receiving a syntax error on the following line of code, and am hoping
somebody more knowledgeable than I can help me define the issue:

If (Me.[Will Prep]) = Don't Know Yet Or (Me.[Underwriting Requirements]) =
Don't Know Yet Or (Me.[Logo]) = Don't Know Yet Or (Me.[Enrollment
Materials])
= Don't Know Yet Or (Me.[Enrollment Method]) = Don't Know Yet Or
(Me.[Online
Experience]) = Don't Know Yet Or (Me.[Enrollment Recordkeeping]) = Don't
Know
Yet Then
If Msgbox(Msg ,vbYesNo)<>vbYes then
cancel = true
end if
End If

Thanks to anyone out there...and everyone who has helped me in the past as
well!

M
 
Oh man...sorry to have missed that!

Brendan Reynolds said:
The second quote in this line is in the wrong place - after the 'Or' when it
should be before it ...

<quote>
Materials]) = "Don't Know Yet Or" (Me.[Enrollment Method]) = "Don't Know
Yet"
</quote>

--
Brendan Reynolds

Monish said:
Brendan - Thanks for taking a look at this...I can show you the entire
code
which may help you better undertand the issue.

Adding the " " did not work unfortunately...

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyMsg As String
MyMsg = "One or more of the following fields within Case Profile are
incomplete:" & Chr(13) & _
"Sales Alert Date " & Chr(13) & _
"Eligibles " & Chr(13) & _
"Region" & Chr(13) & _
"Case Type" & Chr(13) & _
"Industry" & Chr(13) & _
"Product" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

Dim Msg As String
Msg = "One or more of the following fields within Strategy Sold are
incomplete:" & Chr(13) & _
"Will Prep" & Chr(13) & _
"Underwriting Requirements" & Chr(13) & _
"Logo" & Chr(13) & _
"Enrollment Materials" & Chr(13) & _
"Enrollment Method" & Chr(13) & _
"Online Experience" & Chr(13) & _
"Enrollment Recordkeeping" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

If IsNull(Me.[Sales Alert Date]) Or IsNull(Me.[Eligibles]) Or
IsNull(Me.[Region]) Or IsNull(Me.[Case Type]) Or IsNull(Me.[Industry]) Or
IsNull(Me.[Product]) Then
If MsgBox(MyMsg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

If (Me.[Will Prep]) = "Don't Know Yet" Or (Me.[Underwriting Requirements])
=
"Don't Know Yet" Or (Me.[Logo]) = "Don't Know Yet" Or (Me.[Enrollment
Materials]) = "Don't Know Yet Or" (Me.[Enrollment Method]) = "Don't Know
Yet"
Or (Me.[Online Experience]) = "Don't Know Yet" Or (Me.[Enrollment
Recordkeeping]) = "Don't Know Yet" Then
If MsgBox(Msg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

End Sub

Again, thanks
M

Brendan Reynolds said:
It's difficult to be sure without knowing whether those controls are
bound
or unbound, and if they are bound, the data types of the fields to which
they are bound. That said, given the information available, my best guess
is
that you may just need quotes around "Don't Know Yet", something like ...

If (Me.[Will Prep]) = "Don't Know Yet" Or ... etc.

--
Brendan Reynolds

Hi -

I am receiving a syntax error on the following line of code, and am
hoping
somebody more knowledgeable than I can help me define the issue:

If (Me.[Will Prep]) = Don't Know Yet Or (Me.[Underwriting
Requirements]) =
Don't Know Yet Or (Me.[Logo]) = Don't Know Yet Or (Me.[Enrollment
Materials])
= Don't Know Yet Or (Me.[Enrollment Method]) = Don't Know Yet Or
(Me.[Online
Experience]) = Don't Know Yet Or (Me.[Enrollment Recordkeeping]) =
Don't
Know
Yet Then
If Msgbox(Msg ,vbYesNo)<>vbYes then
cancel = true
end if
End If

Thanks to anyone out there...and everyone who has helped me in the past
as
well!

M
 
Wow - thanks John...

JohnGriffiths said:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Cancel = Not ValidateForm()
End Sub

Private Function ValidateForm() As String
'--------------------------------------------
ValidateForm = False
'--------------------------------------------
Dim ErrorMsg As String

ErrorMsg = ValidateControl(Me.[Sales Alert Date])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Eligibles])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Region])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Case Type])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Industry])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Product])

If ErrorMsg <> "" Then
ErrorMsg = "The following fields " & _
"within Case Profile are incomplete:" & Chr(13) & _
ErrorMsg & _
"Would you like to continue anyway?"
If MsgBox(Msg, vbYesNo) <> vbYes Then
Exit Function
End If

End If
'--------------------------------------------
ErrorMsg = ValidateControl(Me.[Will Prep])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Eligibles])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Underwriting Requirements])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Logo])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Enrollment Materials])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Enrollment Method])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Online Experience])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Enrollment Recordkeeping])


If ErrorMsg <> "" Then
ErrorMsg = "The following fields " & _
"within Strategy Sold are incomplete:" & Chr(13) & _
ErrorMsg & _
"Would you like to continue anyway?"
If MsgBox(Msg, vbYesNo) <> vbYes Then
Exit Function
End If

End If
'--------------------------------------------
ValidateForm = True
'--------------------------------------------
End Function

Private Function ValidateControl(InControl As TextBox) As String
'--------------------------------------------
ValidateControl = ""

If IsNull(InControl) Then
ValidateControl = InControl.Name & Chr(13)

ElseIf InControl = "Don't Know Yet" Then
ValidateControl = InControl.Name & Chr(13)

End If
'--------------------------------------------
End Function

Monish said:
Brendan - Thanks for taking a look at this...I can show you the entire code
which may help you better undertand the issue.

Adding the " " did not work unfortunately...

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyMsg As String
MyMsg = "One or more of the following fields within Case Profile are
incomplete:" & Chr(13) & _
"Sales Alert Date " & Chr(13) & _
"Eligibles " & Chr(13) & _
"Region" & Chr(13) & _
"Case Type" & Chr(13) & _
"Industry" & Chr(13) & _
"Product" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

Dim Msg As String
Msg = "One or more of the following fields within Strategy Sold are
incomplete:" & Chr(13) & _
"Will Prep" & Chr(13) & _
"Underwriting Requirements" & Chr(13) & _
"Logo" & Chr(13) & _
"Enrollment Materials" & Chr(13) & _
"Enrollment Method" & Chr(13) & _
"Online Experience" & Chr(13) & _
"Enrollment Recordkeeping" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

If IsNull(Me.[Sales Alert Date]) Or IsNull(Me.[Eligibles]) Or
IsNull(Me.[Region]) Or IsNull(Me.[Case Type]) Or IsNull(Me.[Industry]) Or
IsNull(Me.[Product]) Then
If MsgBox(MyMsg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

If (Me.[Will Prep]) = "Don't Know Yet" Or (Me.[Underwriting Requirements]) =
"Don't Know Yet" Or (Me.[Logo]) = "Don't Know Yet" Or (Me.[Enrollment
Materials]) = "Don't Know Yet Or" (Me.[Enrollment Method]) = "Don't Know Yet"
Or (Me.[Online Experience]) = "Don't Know Yet" Or (Me.[Enrollment
Recordkeeping]) = "Don't Know Yet" Then
If MsgBox(Msg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

End Sub

Again, thanks
M

Brendan Reynolds said:
It's difficult to be sure without knowing whether those controls are bound
or unbound, and if they are bound, the data types of the fields to which
they are bound. That said, given the information available, my best guess is
that you may just need quotes around "Don't Know Yet", something like ....

If (Me.[Will Prep]) = "Don't Know Yet" Or ... etc.

--
Brendan Reynolds

Hi -

I am receiving a syntax error on the following line of code, and am hoping
somebody more knowledgeable than I can help me define the issue:

If (Me.[Will Prep]) = Don't Know Yet Or (Me.[Underwriting Requirements]) =
Don't Know Yet Or (Me.[Logo]) = Don't Know Yet Or (Me.[Enrollment
Materials])
= Don't Know Yet Or (Me.[Enrollment Method]) = Don't Know Yet Or
(Me.[Online
Experience]) = Don't Know Yet Or (Me.[Enrollment Recordkeeping]) = Don't
Know
Yet Then
If Msgbox(Msg ,vbYesNo)<>vbYes then
cancel = true
end if
End If

Thanks to anyone out there...and everyone who has helped me in the past as
well!

M
 
No problem but watch out the posting snuck out of drafts folder, so be aware
that

a) It is all <air code> and may need amending.

b) Private Function ValidateControl(InControl As TextBox) As String
So now I know that all user input is to text box, should be "InControl As
Control" as you may change the form to use more user friendly input
controls.

c) Some names ie "Case Type", "Region" look more like foriegn keys.
This information could be used help the user fill the form quicker and with
greater accuracy.

d) Using the MsgBox should be avoided as much as possible, this solution
uses 2 pop ups, if this was a web site and not your own project, would you
complain?

Have fun - John

Monish said:
Wow - thanks John...

JohnGriffiths said:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Cancel = Not ValidateForm()
End Sub

Private Function ValidateForm() As String
'--------------------------------------------
ValidateForm = False
'--------------------------------------------
Dim ErrorMsg As String

ErrorMsg = ValidateControl(Me.[Sales Alert Date])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Eligibles])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Region])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Case Type])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Industry])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Product])

If ErrorMsg <> "" Then
ErrorMsg = "The following fields " & _
"within Case Profile are incomplete:" & Chr(13) & _
ErrorMsg & _
"Would you like to continue anyway?"
If MsgBox(Msg, vbYesNo) <> vbYes Then
Exit Function
End If

End If
'--------------------------------------------
ErrorMsg = ValidateControl(Me.[Will Prep])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Eligibles])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Underwriting Requirements])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Logo])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Enrollment Materials])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Enrollment Method])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Online Experience])
ErrorMsg = ErrorMsg & ValidateControl(Me.[Enrollment Recordkeeping])


If ErrorMsg <> "" Then
ErrorMsg = "The following fields " & _
"within Strategy Sold are incomplete:" & Chr(13) & _
ErrorMsg & _
"Would you like to continue anyway?"
If MsgBox(Msg, vbYesNo) <> vbYes Then
Exit Function
End If

End If
'--------------------------------------------
ValidateForm = True
'--------------------------------------------
End Function

Private Function ValidateControl(InControl As TextBox) As String
'--------------------------------------------
ValidateControl = ""

If IsNull(InControl) Then
ValidateControl = InControl.Name & Chr(13)

ElseIf InControl = "Don't Know Yet" Then
ValidateControl = InControl.Name & Chr(13)

End If
'--------------------------------------------
End Function

Monish said:
Brendan - Thanks for taking a look at this...I can show you the entire code
which may help you better undertand the issue.

Adding the " " did not work unfortunately...

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyMsg As String
MyMsg = "One or more of the following fields within Case Profile are
incomplete:" & Chr(13) & _
"Sales Alert Date " & Chr(13) & _
"Eligibles " & Chr(13) & _
"Region" & Chr(13) & _
"Case Type" & Chr(13) & _
"Industry" & Chr(13) & _
"Product" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

Dim Msg As String
Msg = "One or more of the following fields within Strategy Sold are
incomplete:" & Chr(13) & _
"Will Prep" & Chr(13) & _
"Underwriting Requirements" & Chr(13) & _
"Logo" & Chr(13) & _
"Enrollment Materials" & Chr(13) & _
"Enrollment Method" & Chr(13) & _
"Online Experience" & Chr(13) & _
"Enrollment Recordkeeping" & Chr(13) & Chr(13) & _
"Would you like to continue anyway?"

If IsNull(Me.[Sales Alert Date]) Or IsNull(Me.[Eligibles]) Or
IsNull(Me.[Region]) Or IsNull(Me.[Case Type]) Or IsNull(Me.[Industry]) Or
IsNull(Me.[Product]) Then
If MsgBox(MyMsg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

If (Me.[Will Prep]) = "Don't Know Yet" Or (Me.[Underwriting
Requirements])
=
"Don't Know Yet" Or (Me.[Logo]) = "Don't Know Yet" Or (Me.[Enrollment
Materials]) = "Don't Know Yet Or" (Me.[Enrollment Method]) = "Don't
Know
Yet"
Or (Me.[Online Experience]) = "Don't Know Yet" Or (Me.[Enrollment
Recordkeeping]) = "Don't Know Yet" Then
If MsgBox(Msg, vbYesNo) <> vbYes Then
Cancel = True
End If
End If

End Sub

Again, thanks
M

:

It's difficult to be sure without knowing whether those controls are bound
or unbound, and if they are bound, the data types of the fields to which
they are bound. That said, given the information available, my best guess is
that you may just need quotes around "Don't Know Yet", something
like
....
If (Me.[Will Prep]) = "Don't Know Yet" Or ... etc.

--
Brendan Reynolds

Hi -

I am receiving a syntax error on the following line of code, and
am
hoping
somebody more knowledgeable than I can help me define the issue:

If (Me.[Will Prep]) = Don't Know Yet Or (Me.[Underwriting Requirements]) =
Don't Know Yet Or (Me.[Logo]) = Don't Know Yet Or (Me.[Enrollment
Materials])
= Don't Know Yet Or (Me.[Enrollment Method]) = Don't Know Yet Or
(Me.[Online
Experience]) = Don't Know Yet Or (Me.[Enrollment Recordkeeping]) = Don't
Know
Yet Then
If Msgbox(Msg ,vbYesNo)<>vbYes then
cancel = true
end if
End If

Thanks to anyone out there...and everyone who has helped me in the past as
well!

M
 
Back
Top