MsgBox results

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

Guest

This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType & "'"


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "'"


End If

stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
///////////

I'm so close to being done, please help...
 
That is not the hard part (maybe none of it's hard to you?)
The difficult part is returning only date that is True.
I've tried these, am I even close?????
All 3 of these just give me both Yes & No results...


If Answer = vbYes Then
TR_EXPEDITED = "True"
End If

//////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=" & "'" & Answer & "'"
End If

//////////////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]= 'True"
End If

/////////////////


Roger Carlson said:
Change Answer to an Integer. Then add an If statement

If Answer = vbYes Then
....and the rest of your code
End If

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


Dan @BCBS said:
This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType & "'"


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "'"


End If

stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
///////////

I'm so close to being done, please help...
 
If TR_EXPEDITED is a boolean field (a Yes/No field as it's called in the
Table Design mode), you need

stExpedited = "[TR_EXPEDITED]= True"

(i.e.: no quotes around True, as it's a keyword)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dan @BCBS said:
That is not the hard part (maybe none of it's hard to you?)
The difficult part is returning only date that is True.
I've tried these, am I even close?????
All 3 of these just give me both Yes & No results...


If Answer = vbYes Then
TR_EXPEDITED = "True"
End If

//////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=" & "'" & Answer & "'"
End If

//////////////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]= 'True"
End If

/////////////////


Roger Carlson said:
Change Answer to an Integer. Then add an If statement

If Answer = vbYes Then
....and the rest of your code
End If

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


Dan @BCBS said:
This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType & "'"


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "'"


End If

stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
///////////

I'm so close to being done, please help...
 
The results are the same as I get with the 3 examples listed below.
TR_EXPEDITED is a boolean..
Again - My results still show both TR_EXPEDITED true and false (-1 and 0)...
Please help me make it show results based on answer to MsgBox Yes/no..



Douglas J Steele said:
If TR_EXPEDITED is a boolean field (a Yes/No field as it's called in the
Table Design mode), you need

stExpedited = "[TR_EXPEDITED]= True"

(i.e.: no quotes around True, as it's a keyword)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dan @BCBS said:
That is not the hard part (maybe none of it's hard to you?)
The difficult part is returning only date that is True.
I've tried these, am I even close?????
All 3 of these just give me both Yes & No results...


If Answer = vbYes Then
TR_EXPEDITED = "True"
End If

//////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=" & "'" & Answer & "'"
End If

//////////////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]= 'True"
End If

/////////////////


Roger Carlson said:
Change Answer to an Integer. Then add an If statement

If Answer = vbYes Then
....and the rest of your code
End If

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType & "'"


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "'"


End If

stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
///////////

I'm so close to being done, please help...
 
looking at your original routine - i cant see where you use the answer to
the msgbox (it needn't be there except to halt the program)- maybe i'm
missing something




Dan @BCBS said:
The results are the same as I get with the 3 examples listed below.
TR_EXPEDITED is a boolean..
Again - My results still show both TR_EXPEDITED true and false (-1 and 0)...
Please help me make it show results based on answer to MsgBox Yes/no..



Douglas J Steele said:
If TR_EXPEDITED is a boolean field (a Yes/No field as it's called in the
Table Design mode), you need

stExpedited = "[TR_EXPEDITED]= True"

(i.e.: no quotes around True, as it's a keyword)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dan @BCBS said:
That is not the hard part (maybe none of it's hard to you?)
The difficult part is returning only date that is True.
I've tried these, am I even close?????
All 3 of these just give me both Yes & No results...


If Answer = vbYes Then
TR_EXPEDITED = "True"
End If

//////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=" & "'" & Answer & "'"
End If

//////////////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]= 'True"
End If

/////////////////


:

Change Answer to an Integer. Then add an If statement

If Answer = vbYes Then
....and the rest of your code
End If

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType & "'"


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "'"


End If

stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
///////////

I'm so close to being done, please help...
 
I'm trying to use it!! That's the whole reason I'm stuck!!
If the person answers YES then I need records with TR_EXPEDITED = true...




JethroUK© said:
looking at your original routine - i cant see where you use the answer to
the msgbox (it needn't be there except to halt the program)- maybe i'm
missing something




Dan @BCBS said:
The results are the same as I get with the 3 examples listed below.
TR_EXPEDITED is a boolean..
Again - My results still show both TR_EXPEDITED true and false (-1 and 0)...
Please help me make it show results based on answer to MsgBox Yes/no..



Douglas J Steele said:
If TR_EXPEDITED is a boolean field (a Yes/No field as it's called in the
Table Design mode), you need

stExpedited = "[TR_EXPEDITED]= True"

(i.e.: no quotes around True, as it's a keyword)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That is not the hard part (maybe none of it's hard to you?)
The difficult part is returning only date that is True.
I've tried these, am I even close?????
All 3 of these just give me both Yes & No results...


If Answer = vbYes Then
TR_EXPEDITED = "True"
End If

//////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=" & "'" & Answer & "'"
End If

//////////////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]= 'True"
End If

/////////////////


:

Change Answer to an Integer. Then add an If statement

If Answer = vbYes Then
....and the rest of your code
End If

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with
TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType & "'"


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "'"


End If

stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
///////////

I'm so close to being done, please help...
 
I thought Doug's response answered your question.

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=True"
Else
stExpedited = "[TR_EXPEDITED]=False"
End If

On the other hand, you don't even need the If:

stExpedited = "[TR_EXPEDITED]=" & Answer

You just needed to get rid of the quotes around Answer.
--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


Dan @BCBS said:
I'm trying to use it!! That's the whole reason I'm stuck!!
If the person answers YES then I need records with TR_EXPEDITED = true...




JethroUK© said:
looking at your original routine - i cant see where you use the answer to
the msgbox (it needn't be there except to halt the program)- maybe i'm
missing something




Dan @BCBS said:
The results are the same as I get with the 3 examples listed below.
TR_EXPEDITED is a boolean..
Again - My results still show both TR_EXPEDITED true and false (-1 and 0)...
Please help me make it show results based on answer to MsgBox Yes/no..



:

If TR_EXPEDITED is a boolean field (a Yes/No field as it's called in the
Table Design mode), you need

stExpedited = "[TR_EXPEDITED]= True"

(i.e.: no quotes around True, as it's a keyword)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That is not the hard part (maybe none of it's hard to you?)
The difficult part is returning only date that is True.
I've tried these, am I even close?????
All 3 of these just give me both Yes & No results...


If Answer = vbYes Then
TR_EXPEDITED = "True"
End If

//////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=" & "'" & Answer & "'"
End If

//////////////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]= 'True"
End If

/////////////////


:

Change Answer to an Integer. Then add an If statement

If Answer = vbYes Then
....and the rest of your code
End If

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with
TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" &
Me.InqType &
"'"
If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "'"


End If

stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
///////////

I'm so close to being done, please help...
 
Actually, you do need the If in this case.

As coded, the message box will return vbYes or vbNo. vbYes is 6, vbNo is 7.

If you used "[TR_EXPEDITED]=" & Answer, you'd always be looking for True, as
any non-zero value is treated as True.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Roger Carlson said:
I thought Doug's response answered your question.

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=True"
Else
stExpedited = "[TR_EXPEDITED]=False"
End If

On the other hand, you don't even need the If:

stExpedited = "[TR_EXPEDITED]=" & Answer

You just needed to get rid of the quotes around Answer.
--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


Dan @BCBS said:
I'm trying to use it!! That's the whole reason I'm stuck!!
If the person answers YES then I need records with TR_EXPEDITED = true...
in
the
Table Design mode), you need

stExpedited = "[TR_EXPEDITED]= True"

(i.e.: no quotes around True, as it's a keyword)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That is not the hard part (maybe none of it's hard to you?)
The difficult part is returning only date that is True.
I've tried these, am I even close?????
All 3 of these just give me both Yes & No results...


If Answer = vbYes Then
TR_EXPEDITED = "True"
End If

//////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=" & "'" & Answer & "'"
End If

//////////////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]= 'True"
End If

/////////////////


:

Change Answer to an Integer. Then add an If statement

If Answer = vbYes Then
....and the rest of your code
End If

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with
TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType &
"'"


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode
&
 
But it does nothing except hold the answer Yes or No...
How do I make the report/output show only the YES or No answers??????????????

Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")
stExpedited = "[TR_EXPEDITED]=" & Answer

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType & "'"

If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "'"
End If
stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria




Roger Carlson said:
I thought Doug's response answered your question.

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=True"
Else
stExpedited = "[TR_EXPEDITED]=False"
End If

On the other hand, you don't even need the If:

stExpedited = "[TR_EXPEDITED]=" & Answer

You just needed to get rid of the quotes around Answer.
--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


Dan @BCBS said:
I'm trying to use it!! That's the whole reason I'm stuck!!
If the person answers YES then I need records with TR_EXPEDITED = true...




JethroUK© said:
looking at your original routine - i cant see where you use the answer to
the msgbox (it needn't be there except to halt the program)- maybe i'm
missing something




The results are the same as I get with the 3 examples listed below.
TR_EXPEDITED is a boolean..
Again - My results still show both TR_EXPEDITED true and false (-1 and
0)...
Please help me make it show results based on answer to MsgBox Yes/no..



:

If TR_EXPEDITED is a boolean field (a Yes/No field as it's called in the
Table Design mode), you need

stExpedited = "[TR_EXPEDITED]= True"

(i.e.: no quotes around True, as it's a keyword)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That is not the hard part (maybe none of it's hard to you?)
The difficult part is returning only date that is True.
I've tried these, am I even close?????
All 3 of these just give me both Yes & No results...


If Answer = vbYes Then
TR_EXPEDITED = "True"
End If

//////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=" & "'" & Answer & "'"
End If

//////////////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]= 'True"
End If

/////////////////


:

Change Answer to an Integer. Then add an If statement

If Answer = vbYes Then
....and the rest of your code
End If

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with
TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType &
"'"


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "'"


End If

stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
///////////

I'm so close to being done, please help...
 
Doh! Good catch Doug!

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


Douglas J Steele said:
Actually, you do need the If in this case.

As coded, the message box will return vbYes or vbNo. vbYes is 6, vbNo is 7.

If you used "[TR_EXPEDITED]=" & Answer, you'd always be looking for True, as
any non-zero value is treated as True.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Roger Carlson said:
I thought Doug's response answered your question.

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=True"
Else
stExpedited = "[TR_EXPEDITED]=False"
End If

On the other hand, you don't even need the If:

stExpedited = "[TR_EXPEDITED]=" & Answer

You just needed to get rid of the quotes around Answer.
--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


Dan @BCBS said:
I'm trying to use it!! That's the whole reason I'm stuck!!
If the person answers YES then I need records with TR_EXPEDITED = true...




:

looking at your original routine - i cant see where you use the
answer
to
the msgbox (it needn't be there except to halt the program)- maybe i'm
missing something




The results are the same as I get with the 3 examples listed below.
TR_EXPEDITED is a boolean..
Again - My results still show both TR_EXPEDITED true and false (-1 and
0)...
Please help me make it show results based on answer to MsgBox Yes/no..



:

If TR_EXPEDITED is a boolean field (a Yes/No field as it's
called
in
the
Table Design mode), you need

stExpedited = "[TR_EXPEDITED]= True"

(i.e.: no quotes around True, as it's a keyword)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That is not the hard part (maybe none of it's hard to you?)
The difficult part is returning only date that is True.
I've tried these, am I even close?????
All 3 of these just give me both Yes & No results...


If Answer = vbYes Then
TR_EXPEDITED = "True"
End If

//////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=" & "'" & Answer & "'"
End If

//////////////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]= 'True"
End If

/////////////////


:

Change Answer to an Integer. Then add an If statement

If Answer = vbYes Then
....and the rest of your code
End If

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with
TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType &
"'"


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" &
Me.DecCode
 
I don't know. You haven't explained where you want using TR_EXPEDITED
anywhere. (Guessing here) If you want to add it to you stLinkCriteria, then
do this:

Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")
If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=True"
Else
stExpedited = "[TR_EXPEDITED]=False"
End If

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType & "' AND " &
stExpedited


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "' AND "&
stExpedited

End If

stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria


--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L



Dan @BCBS said:
But it does nothing except hold the answer Yes or No...
How do I make the report/output show only the YES or No answers??????????????

Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo, "Question")
stExpedited = "[TR_EXPEDITED]=" & Answer

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType & "'"

If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" & Me.DecCode & "'"
End If
stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria




Roger Carlson said:
I thought Doug's response answered your question.

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=True"
Else
stExpedited = "[TR_EXPEDITED]=False"
End If

On the other hand, you don't even need the If:

stExpedited = "[TR_EXPEDITED]=" & Answer

You just needed to get rid of the quotes around Answer.
--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


Dan @BCBS said:
I'm trying to use it!! That's the whole reason I'm stuck!!
If the person answers YES then I need records with TR_EXPEDITED = true...




:

looking at your original routine - i cant see where you use the
answer
to
the msgbox (it needn't be there except to halt the program)- maybe i'm
missing something




The results are the same as I get with the 3 examples listed below.
TR_EXPEDITED is a boolean..
Again - My results still show both TR_EXPEDITED true and false (-1 and
0)...
Please help me make it show results based on answer to MsgBox Yes/no..



:

If TR_EXPEDITED is a boolean field (a Yes/No field as it's
called in
the
Table Design mode), you need

stExpedited = "[TR_EXPEDITED]= True"

(i.e.: no quotes around True, as it's a keyword)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That is not the hard part (maybe none of it's hard to you?)
The difficult part is returning only date that is True.
I've tried these, am I even close?????
All 3 of these just give me both Yes & No results...


If Answer = vbYes Then
TR_EXPEDITED = "True"
End If

//////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]=" & "'" & Answer & "'"
End If

//////////////////////////
Dim stExpedited As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If Answer = vbYes Then
stExpedited = "[TR_EXPEDITED]= 'True"
End If

/////////////////


:

Change Answer to an Integer. Then add an If statement

If Answer = vbYes Then
....and the rest of your code
End If

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


This code is fine, but I need to add the results of my MsgBox.

If the person answers YES - I need to show only records with
TR_EXPEDITED
that are True...

?? something like: IF ANSWER = YES THEN TR_EXPEDITED=TRUE??




Dim stDocName As String
Dim stLinkCriteria As String
Dim Answer As String

Answer = MsgBox("Expedited Case??", vbQuestion + vbYesNo,
"Question")

If IsNull(Me.StartDate) Or IsNull(Me.EndDate) Then
MsgBox "You must enter a Start & Stop date."
End If

If Not (IsNull(Me.InqType)) Then
stLinkCriteria = "[TR_INQUIRYTYPE]=" & "'" & Me.InqType &
"'"


If Not (IsNull(Me.DecCode)) Then
stLinkCriteria = "[TR_DECISION]=" & "'" &
Me.DecCode &
"'"
End If

stDocName = "r_GroupBasic"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
///////////

I'm so close to being done, please help...
 
Back
Top