A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

If Statement w/ And and Msgbox Nested



 
 
Thread Tools Display Modes
  #1  
Old January 4th, 2010, 11:13 PM posted to microsoft.public.access.forms
Pamela
external usenet poster
 
Posts: 193
Default If Statement w/ And and Msgbox Nested

I am getting a syntax error on this code. The code is intended to check that
the user entered data into the Remarks field if they also selected the text
that goes with the ID # 2 in cbFOLConsistent. ID (AutoNumber,pk) is the bound
control in my cbo but it displays text. I want the Msgbox to display Yes/No
buttons and on Yes set focus to Remarks so that the user is forced to make
their explanation. In the No case, I want the focus set to
Me.Parent!cbFOLConsistent so that the user can change their selection. I
actually had a lot more text in my msgbox but since I was having trouble,
trimmed it to narrow down my mistake so I understand that the box doesn't
make sense as it is. Here's my code:

If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2" Then
If MsgBox("If the Facts of Loss are not consistent with the damage,") =
vbYes Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If
Thanks for your help!
Pamela
  #2  
Old January 5th, 2010, 12:06 AM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default If Statement w/ And and Msgbox Nested

Pamela

If MsgBox("blah, blah, blah", vbYesNo,"Title of msgbox") = vbYes Then

Try checking Access HELP on the MsgBox function... for the complete syntax.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Pamela" wrote in message
...
I am getting a syntax error on this code. The code is intended to check
that
the user entered data into the Remarks field if they also selected the
text
that goes with the ID # 2 in cbFOLConsistent. ID (AutoNumber,pk) is the
bound
control in my cbo but it displays text. I want the Msgbox to display
Yes/No
buttons and on Yes set focus to Remarks so that the user is forced to make
their explanation. In the No case, I want the focus set to
Me.Parent!cbFOLConsistent so that the user can change their selection. I
actually had a lot more text in my msgbox but since I was having trouble,
trimmed it to narrow down my mistake so I understand that the box doesn't
make sense as it is. Here's my code:

If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2" Then
If MsgBox("If the Facts of Loss are not consistent with the damage,") =
vbYes Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If
Thanks for your help!
Pamela



  #3  
Old January 5th, 2010, 01:38 AM posted to microsoft.public.access.forms
Pamela
external usenet poster
 
Posts: 193
Default If Statement w/ And and Msgbox Nested

Hi Jeff,
I think my code for the MsgBox isn't the problem but rather the If
statement. I don't get an error, but no matter how I meet the criteria, I
don't get the intended message box to open which makes me think that somehow
my double criteria (If w/ AND) is the problem. Any ideas??

Pamela

"Jeff Boyce" wrote:

Pamela

If MsgBox("blah, blah, blah", vbYesNo,"Title of msgbox") = vbYes Then

Try checking Access HELP on the MsgBox function... for the complete syntax.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Pamela" wrote in message
...
I am getting a syntax error on this code. The code is intended to check
that
the user entered data into the Remarks field if they also selected the
text
that goes with the ID # 2 in cbFOLConsistent. ID (AutoNumber,pk) is the
bound
control in my cbo but it displays text. I want the Msgbox to display
Yes/No
buttons and on Yes set focus to Remarks so that the user is forced to make
their explanation. In the No case, I want the focus set to
Me.Parent!cbFOLConsistent so that the user can change their selection. I
actually had a lot more text in my msgbox but since I was having trouble,
trimmed it to narrow down my mistake so I understand that the box doesn't
make sense as it is. Here's my code:

If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2" Then
If MsgBox("If the Facts of Loss are not consistent with the damage,") =
vbYes Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If
Thanks for your help!
Pamela



.

  #4  
Old January 5th, 2010, 02:05 AM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default If Statement w/ And and Msgbox Nested

On Mon, 4 Jan 2010 17:38:01 -0800, Pamela
wrote:

I think the problem may be with the first line:
If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2"
Then

Currently this line means: if there are any remarks and
cbFOLConsistent = 2 then...
Is that what you meant?

Set a breakpoint on the first line, re-run the code, and step through,
carefully inspecting the various values (either by hovering over the
variable name, or by using other debugging windows, or by entering
something like:
?Me.Remarks
or
?Len(remarks & vbNullString)
in the immediate window.
I bet you some values are not what you expected them to be.

-Tom.
Microsoft Access MVP



Hi Jeff,
I think my code for the MsgBox isn't the problem but rather the If
statement. I don't get an error, but no matter how I meet the criteria, I
don't get the intended message box to open which makes me think that somehow
my double criteria (If w/ AND) is the problem. Any ideas??

Pamela

"Jeff Boyce" wrote:

Pamela

If MsgBox("blah, blah, blah", vbYesNo,"Title of msgbox") = vbYes Then

Try checking Access HELP on the MsgBox function... for the complete syntax.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Pamela" wrote in message
...
I am getting a syntax error on this code. The code is intended to check
that
the user entered data into the Remarks field if they also selected the
text
that goes with the ID # 2 in cbFOLConsistent. ID (AutoNumber,pk) is the
bound
control in my cbo but it displays text. I want the Msgbox to display
Yes/No
buttons and on Yes set focus to Remarks so that the user is forced to make
their explanation. In the No case, I want the focus set to
Me.Parent!cbFOLConsistent so that the user can change their selection. I
actually had a lot more text in my msgbox but since I was having trouble,
trimmed it to narrow down my mistake so I understand that the box doesn't
make sense as it is. Here's my code:

If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2" Then
If MsgBox("If the Facts of Loss are not consistent with the damage,") =
vbYes Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If
Thanks for your help!
Pamela



.

  #5  
Old January 5th, 2010, 03:16 AM posted to microsoft.public.access.forms
Pamela
external usenet poster
 
Posts: 193
Default If Statement w/ And and Msgbox Nested

Thanks for bringing that to my attention. I just try to copy code and mix it
in where and how I think I need it but I can't say I necessarily really
understand how it all works and what it all means.
Any suggestions on how to write the first line so that if Remarks is
empty/null (is blank) AND FOLConsistent is 2 that the msgbox then opens?? It
makes sense that it isn't working based on your synopsis of the first line.
Thanks so much!
Pamela

"Tom van Stiphout" wrote:

On Mon, 4 Jan 2010 17:38:01 -0800, Pamela
wrote:

I think the problem may be with the first line:
If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2"
Then

Currently this line means: if there are any remarks and
cbFOLConsistent = 2 then...
Is that what you meant?

Set a breakpoint on the first line, re-run the code, and step through,
carefully inspecting the various values (either by hovering over the
variable name, or by using other debugging windows, or by entering
something like:
?Me.Remarks
or
?Len(remarks & vbNullString)
in the immediate window.
I bet you some values are not what you expected them to be.

-Tom.
Microsoft Access MVP



Hi Jeff,
I think my code for the MsgBox isn't the problem but rather the If
statement. I don't get an error, but no matter how I meet the criteria, I
don't get the intended message box to open which makes me think that somehow
my double criteria (If w/ AND) is the problem. Any ideas??

Pamela

"Jeff Boyce" wrote:

Pamela

If MsgBox("blah, blah, blah", vbYesNo,"Title of msgbox") = vbYes Then

Try checking Access HELP on the MsgBox function... for the complete syntax.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Pamela" wrote in message
...
I am getting a syntax error on this code. The code is intended to check
that
the user entered data into the Remarks field if they also selected the
text
that goes with the ID # 2 in cbFOLConsistent. ID (AutoNumber,pk) is the
bound
control in my cbo but it displays text. I want the Msgbox to display
Yes/No
buttons and on Yes set focus to Remarks so that the user is forced to make
their explanation. In the No case, I want the focus set to
Me.Parent!cbFOLConsistent so that the user can change their selection. I
actually had a lot more text in my msgbox but since I was having trouble,
trimmed it to narrow down my mistake so I understand that the box doesn't
make sense as it is. Here's my code:

If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2" Then
If MsgBox("If the Facts of Loss are not consistent with the damage,") =
vbYes Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If
Thanks for your help!
Pamela


.

.

  #6  
Old January 5th, 2010, 03:38 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default If Statement w/ And and Msgbox Nested

On Mon, 4 Jan 2010 19:16:03 -0800, Pamela
wrote:

Any suggestions on how to write the first line so that if Remarks is
empty/null (is blank) AND FOLConsistent is 2 that the msgbox then opens??


Make it

If Len(Me.Remarks & vbNullString)=0 And Me.Parent!cbFOLConsistent = "2" Then

This will explicitly check that Remarks is empty.
--

John W. Vinson [MVP]
  #7  
Old January 5th, 2010, 04:11 AM posted to microsoft.public.access.forms
Pamela
external usenet poster
 
Posts: 193
Default If Statement w/ And and Msgbox Nested

After some trial and error, I got it....thanks though!
Here's what worked:
If IsNull(Me.Remarks) And (Me.Parent!cbFOLConsistent = "2") Then
If MsgBox("If the Facts of Loss are not consistent with the damage, an
explanation must be made in Remarks") = vbOK Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If

"Tom van Stiphout" wrote:

On Mon, 4 Jan 2010 17:38:01 -0800, Pamela
wrote:

I think the problem may be with the first line:
If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2"
Then

Currently this line means: if there are any remarks and
cbFOLConsistent = 2 then...
Is that what you meant?

Set a breakpoint on the first line, re-run the code, and step through,
carefully inspecting the various values (either by hovering over the
variable name, or by using other debugging windows, or by entering
something like:
?Me.Remarks
or
?Len(remarks & vbNullString)
in the immediate window.
I bet you some values are not what you expected them to be.

-Tom.
Microsoft Access MVP



Hi Jeff,
I think my code for the MsgBox isn't the problem but rather the If
statement. I don't get an error, but no matter how I meet the criteria, I
don't get the intended message box to open which makes me think that somehow
my double criteria (If w/ AND) is the problem. Any ideas??

Pamela

"Jeff Boyce" wrote:

Pamela

If MsgBox("blah, blah, blah", vbYesNo,"Title of msgbox") = vbYes Then

Try checking Access HELP on the MsgBox function... for the complete syntax.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Pamela" wrote in message
...
I am getting a syntax error on this code. The code is intended to check
that
the user entered data into the Remarks field if they also selected the
text
that goes with the ID # 2 in cbFOLConsistent. ID (AutoNumber,pk) is the
bound
control in my cbo but it displays text. I want the Msgbox to display
Yes/No
buttons and on Yes set focus to Remarks so that the user is forced to make
their explanation. In the No case, I want the focus set to
Me.Parent!cbFOLConsistent so that the user can change their selection. I
actually had a lot more text in my msgbox but since I was having trouble,
trimmed it to narrow down my mistake so I understand that the box doesn't
make sense as it is. Here's my code:

If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2" Then
If MsgBox("If the Facts of Loss are not consistent with the damage,") =
vbYes Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If
Thanks for your help!
Pamela


.

.

  #8  
Old January 5th, 2010, 05:28 PM posted to microsoft.public.access.forms
Chegu Tom
external usenet poster
 
Posts: 140
Default If Statement w/ And and Msgbox Nested

Be careful if your tables allow a null string "" in the remarks field
if me.remarks has "" in it, your IF IsNull will not work as you expect.

You can set that in your table design to not allow null string.

"Pamela" wrote in message
...
After some trial and error, I got it....thanks though!
Here's what worked:
If IsNull(Me.Remarks) And (Me.Parent!cbFOLConsistent = "2") Then
If MsgBox("If the Facts of Loss are not consistent with the damage, an
explanation must be made in Remarks") = vbOK Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If

"Tom van Stiphout" wrote:

On Mon, 4 Jan 2010 17:38:01 -0800, Pamela
wrote:

I think the problem may be with the first line:
If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2"
Then

Currently this line means: if there are any remarks and
cbFOLConsistent = 2 then...
Is that what you meant?

Set a breakpoint on the first line, re-run the code, and step through,
carefully inspecting the various values (either by hovering over the
variable name, or by using other debugging windows, or by entering
something like:
?Me.Remarks
or
?Len(remarks & vbNullString)
in the immediate window.
I bet you some values are not what you expected them to be.

-Tom.
Microsoft Access MVP



Hi Jeff,
I think my code for the MsgBox isn't the problem but rather the If
statement. I don't get an error, but no matter how I meet the criteria,
I
don't get the intended message box to open which makes me think that
somehow
my double criteria (If w/ AND) is the problem. Any ideas??

Pamela

"Jeff Boyce" wrote:

Pamela

If MsgBox("blah, blah, blah", vbYesNo,"Title of msgbox") = vbYes Then

Try checking Access HELP on the MsgBox function... for the complete
syntax.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services
mentioned
in this post. Mention and/or description of a product or service
herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with
no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Pamela" wrote in message
...
I am getting a syntax error on this code. The code is intended to
check
that
the user entered data into the Remarks field if they also selected
the
text
that goes with the ID # 2 in cbFOLConsistent. ID (AutoNumber,pk) is
the
bound
control in my cbo but it displays text. I want the Msgbox to
display
Yes/No
buttons and on Yes set focus to Remarks so that the user is forced
to make
their explanation. In the No case, I want the focus set to
Me.Parent!cbFOLConsistent so that the user can change their
selection. I
actually had a lot more text in my msgbox but since I was having
trouble,
trimmed it to narrow down my mistake so I understand that the box
doesn't
make sense as it is. Here's my code:

If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent =
"2" Then
If MsgBox("If the Facts of Loss are not consistent with the
damage,") =
vbYes Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If
Thanks for your help!
Pamela


.

.



  #9  
Old January 5th, 2010, 06:00 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default If Statement w/ And and Msgbox Nested

Or use

If Len(Me.Remarks & vbNullString) = 0 And (Me.Parent!cbFOLConsistent = "2")
Then

That will work whether or not zero-length strings are allowed.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Chegu Tom" wrote in message
...
Be careful if your tables allow a null string "" in the remarks field
if me.remarks has "" in it, your IF IsNull will not work as you expect.

You can set that in your table design to not allow null string.

"Pamela" wrote in message
...
After some trial and error, I got it....thanks though!
Here's what worked:
If IsNull(Me.Remarks) And (Me.Parent!cbFOLConsistent = "2") Then
If MsgBox("If the Facts of Loss are not consistent with the damage, an
explanation must be made in Remarks") = vbOK Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If

"Tom van Stiphout" wrote:

On Mon, 4 Jan 2010 17:38:01 -0800, Pamela
wrote:

I think the problem may be with the first line:
If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2"
Then

Currently this line means: if there are any remarks and
cbFOLConsistent = 2 then...
Is that what you meant?

Set a breakpoint on the first line, re-run the code, and step through,
carefully inspecting the various values (either by hovering over the
variable name, or by using other debugging windows, or by entering
something like:
?Me.Remarks
or
?Len(remarks & vbNullString)
in the immediate window.
I bet you some values are not what you expected them to be.

-Tom.
Microsoft Access MVP



Hi Jeff,
I think my code for the MsgBox isn't the problem but rather the If
statement. I don't get an error, but no matter how I meet the
criteria, I
don't get the intended message box to open which makes me think that
somehow
my double criteria (If w/ AND) is the problem. Any ideas??

Pamela

"Jeff Boyce" wrote:

Pamela

If MsgBox("blah, blah, blah", vbYesNo,"Title of msgbox") = vbYes Then

Try checking Access HELP on the MsgBox function... for the complete
syntax.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services
mentioned
in this post. Mention and/or description of a product or service
herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with
no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Pamela" wrote in message
...
I am getting a syntax error on this code. The code is intended to
check
that
the user entered data into the Remarks field if they also selected
the
text
that goes with the ID # 2 in cbFOLConsistent. ID (AutoNumber,pk) is
the
bound
control in my cbo but it displays text. I want the Msgbox to
display
Yes/No
buttons and on Yes set focus to Remarks so that the user is forced
to make
their explanation. In the No case, I want the focus set to
Me.Parent!cbFOLConsistent so that the user can change their
selection. I
actually had a lot more text in my msgbox but since I was having
trouble,
trimmed it to narrow down my mistake so I understand that the box
doesn't
make sense as it is. Here's my code:

If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent =
"2" Then
If MsgBox("If the Facts of Loss are not consistent with the
damage,") =
vbYes Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If
Thanks for your help!
Pamela


.

.





  #10  
Old January 6th, 2010, 11:05 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default If Statement w/ And and Msgbox Nested

Hmm. May want parentheses in there. To avoid the line-wrap problem, let's
try:

If (Len(Me.Remarks & vbNullString) = 0) And _
(Me.Parent!cbFOLConsistent = "2") Then


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Douglas J. Steele" wrote in message
...
Or use

If Len(Me.Remarks & vbNullString) = 0 And (Me.Parent!cbFOLConsistent =
"2") Then

That will work whether or not zero-length strings are allowed.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Chegu Tom" wrote in message
...
Be careful if your tables allow a null string "" in the remarks field
if me.remarks has "" in it, your IF IsNull will not work as you expect.

You can set that in your table design to not allow null string.

"Pamela" wrote in message
...
After some trial and error, I got it....thanks though!
Here's what worked:
If IsNull(Me.Remarks) And (Me.Parent!cbFOLConsistent = "2") Then
If MsgBox("If the Facts of Loss are not consistent with the damage, an
explanation must be made in Remarks") = vbOK Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If

"Tom van Stiphout" wrote:

On Mon, 4 Jan 2010 17:38:01 -0800, Pamela
wrote:

I think the problem may be with the first line:
If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent = "2"
Then

Currently this line means: if there are any remarks and
cbFOLConsistent = 2 then...
Is that what you meant?

Set a breakpoint on the first line, re-run the code, and step through,
carefully inspecting the various values (either by hovering over the
variable name, or by using other debugging windows, or by entering
something like:
?Me.Remarks
or
?Len(remarks & vbNullString)
in the immediate window.
I bet you some values are not what you expected them to be.

-Tom.
Microsoft Access MVP



Hi Jeff,
I think my code for the MsgBox isn't the problem but rather the If
statement. I don't get an error, but no matter how I meet the
criteria, I
don't get the intended message box to open which makes me think that
somehow
my double criteria (If w/ AND) is the problem. Any ideas??

Pamela

"Jeff Boyce" wrote:

Pamela

If MsgBox("blah, blah, blah", vbYesNo,"Title of msgbox") = vbYes
Then

Try checking Access HELP on the MsgBox function... for the complete
syntax.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services
mentioned
in this post. Mention and/or description of a product or service
herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is",
with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Pamela" wrote in message
...
I am getting a syntax error on this code. The code is intended to
check
that
the user entered data into the Remarks field if they also selected
the
text
that goes with the ID # 2 in cbFOLConsistent. ID (AutoNumber,pk)
is the
bound
control in my cbo but it displays text. I want the Msgbox to
display
Yes/No
buttons and on Yes set focus to Remarks so that the user is forced
to make
their explanation. In the No case, I want the focus set to
Me.Parent!cbFOLConsistent so that the user can change their
selection. I
actually had a lot more text in my msgbox but since I was having
trouble,
trimmed it to narrow down my mistake so I understand that the box
doesn't
make sense as it is. Here's my code:

If Len(Me.Remarks & vbNullString) And Me.Parent!cbFOLConsistent =
"2" Then
If MsgBox("If the Facts of Loss are not consistent with the
damage,") =
vbYes Then
Me.Remarks.SetFocus

Else
Me.Parent!cbFOLConsistent.Undo

Response = acDataErrContinue

End If
End If
Thanks for your help!
Pamela


.

.






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:13 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.