<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="cid:filelist.xml@01C2E2F7.6CFAA400">
<title>Message</title>
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:RelyOnVML/>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:Zoom>0</w:Zoom>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;
        mso-font-charset:2;
        mso-generic-font-family:auto;
        mso-font-pitch:variable;
        mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:553679495 -2147483648 8 0 66047 0;}
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
        {margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
p
        {margin-right:0in;
        mso-margin-top-alt:auto;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
span.EmailStyle16
        {mso-style-type:personal-reply;
        mso-ansi-font-size:10.0pt;
        mso-ascii-font-family:Arial;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
</head>

<body lang=EN-US style='tab-interval:.5in'>

<div class=Section1>

<p class=MsoNormal><span class=EmailStyle16><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'>I will
have to respectfully disagree with the previous recommendations.<span
style="mso-spacerun: yes">  </span>LIKE will prevent your sp from
compiling in the first place, while the usage of EXEC is very proper in the
original code. <span style="mso-spacerun: yes"> </span>Although the
suggested form is still valid, specifying named parameters is actually
encouraged for the clarity of the code, and MS fully supports EXEC sp_PROC
@Parm1=’<value>’, @Parm2=<value>, etc.<o:p></o:p></span></font></span></p>

<p class=MsoNormal><span class=EmailStyle16><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></font></span></p>

<p class=MsoAutoSig><!--[if supportFields]><span class=EmailStyle16><font 
size=2 color=navy face=Arial><span style='font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial'><span style='mso-element:field-begin'></span><span 
style="mso-spacerun: yes"> </span>AUTOTEXTLIST \s "E-mail 
Signature" <span style='mso-element:field-separator'></span></span></font></span><![endif]--><b><font
color=navy face="Courier New"><span style='font-family:"Courier New";
color:navy;font-weight:bold'>Robert Djabarov<o:p></o:p></span></font></b></p>

<p class=MsoAutoSig><font size=3 color=navy face="Courier New"><span
style='font-size:12.0pt;font-family:"Courier New";color:navy'>Senior SQL Server
DBA<o:p></o:p></span></font></p>

<p class=MsoAutoSig><font size=3 color=navy face="Courier New"><span
style='font-size:12.0pt;font-family:"Courier New";color:navy'>USAA IT/DBMS</span></font><font
color=navy face="Courier New"><span style='font-family:"Courier New";
color:navy;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoAutoSig><font size=3 color=blue face=Wingdings><span
style='font-size:12.0pt;font-family:Wingdings;mso-bidi-font-family:"Courier New";
color:blue'>(</span></font><font color=navy face="Courier New"><span
style='font-family:"Courier New";color:navy'> </span></font><font color=blue
face="Courier New"><span style='font-family:"Courier New";color:blue'>(210)
913-3148 - phone</span></font><font color=navy face="Courier New"><span
style='font-family:"Courier New";color:navy;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoAutoSig><font size=3 color=purple face=Wingdings><span
style='font-size:12.0pt;font-family:Wingdings;mso-bidi-font-family:"Courier New";
color:purple'>(</span></font><font color=navy face="Courier New"><span
style='font-family:"Courier New";color:navy'> </span></font><font color=purple
face="Courier New"><span style='font-family:"Courier New";color:purple'>(210)
753-3148 - pager</span></font><font color=navy face="Courier New"><span
style='font-family:"Courier New";color:navy;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal><!--[if supportFields]><span class=EmailStyle16><font 
size=2 color=navy face=Arial><span style='font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial'><span style='mso-element:field-end'></span></span></font></span><![endif]--><span
class=EmailStyle16><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></font></span></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=black
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;color:black'>-----Original
Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> Mike and Doris Manning
[mailto:mikedorism@ntelos.net]<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, March 05, 2003
7:25 AM<br>
<b><span style='font-weight:bold'>To:</span></b> dba-sqlserver@databaseadvisors.com<br>
<b><span style='font-weight:bold'>Subject:</span></b> RE:
[dba-SQLServer]Calling a Sproc with Parameter</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:blue'>Two things.</span></font><font
color=black><span style='color:black;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'> </span></font><font
color=black><span style='color:black;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:blue'>1)  Make sure your
sproc is looking for LIKE @AccStatus and not = @AccStatus</span></font><font
color=black><span style='color:black;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'> </span></font><font
color=black><span style='color:black;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:blue'>2)  When you use
EXEC, you don't add the name of the parameter.</span></font><font color=black><span
style='color:black;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'>"EXEC
spfrmCustomers 'Active'" </span></font><font color=black><span
style='color:black;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'> </span></font><font
color=black><span style='color:black;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=black
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:black'>Doris
Manning</span></font><font color=black><span style='color:black;mso-color-alt:
windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=black
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:black'>Database
Administrator</span></font><font color=black><span style='color:black;
mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=black
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:black'>Hargrove
Inc.</span></font><font color=black><span style='color:black;mso-color-alt:
windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><u><font size=2 color=blue
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:blue'>www.hargroveinc.com</span></font></u><font
color=black><span style='color:black;mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
margin-left:1.0in'><font size=2 color=black face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma;color:black'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b>
dba-sqlserver-admin@databaseadvisors.com
[mailto:dba-sqlserver-admin@databaseadvisors.com] <b><span style='font-weight:
bold'>On Behalf Of </span></b>David Emerson<br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, March 04, 2003
07:01 PM<br>
<b><span style='font-weight:bold'>To:</span></b>
dba-SQLServer@databaseadvisors.com<br>
<b><span style='font-weight:bold'>Subject:</span></b> [dba-SQLServer]Calling a
Sproc with Parameter</span></font><font color=black><span style='color:black;
mso-color-alt:windowtext'><o:p></o:p></span></font></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'>I have a button on a form which is used to
filter the records.  The code is -<br>
<br>
Private Sub cmdCustomerFilter_Click()<br>
<br>
    On Error GoTo Err_cmdCustomerFilter_Click<br>
    <br>
    If Me!cmdCustomerFilter.Caption = "Show Active"
Then<br>
        Me.RecordSource = "EXEC
spfrmCustomers @AccStatus = 'Active'"  <- Problem line<br>
        Me!cmdCustomerFilter.Caption =
"Show All"<br>
    Else<br>
        Me.RecordSource = "EXEC
spfrmCustomers @AccStatus='%'"<br>
        Me!cmdCustomerFilter.Caption =
"Show Active"<br>
    End If<br>
.....    <br>
    <br>
End Sub<br>
<br>
In the sproc the parameter is -<br>
<br>
</span></font><font color=black face=Tahoma><span style='font-family:Tahoma;
color:black'>@AccStatus varchar(20) = '%'<br>
<br>
</span></font><font color=black><span style='color:black'>When I click on the
button I get error 2353 - Bad query parameter.  I can run the query in
Query analyser and it runs ok.<br>
<br>
If I leave the @AccStatus = 'Active' off then a message appears telling me that
the procedure expects the parameter (so this tells me it is calling the correct
sproc)<br>
<br>
I think the problem is in the call but can't put my finger on it.  Any
help?<br>
<br style='mso-special-character:line-break'>
<![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
<![endif]></span></font><font color=black><span style='color:black;mso-color-alt:
windowtext'><o:p></o:p></span></font></p>

<X-SIGSEP>

<p style='margin-left:1.0in'></X-SIGSEP><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt;color:black'>Regards<br>
<br>
David Emerson<br>
DALYN Software Ltd<br>
25b Cunliffe St, Johnsonville<br>
Wellington, New Zealand<br>
Ph/Fax (877) 456-1205 </span></font><font color=black><span style='color:black;
mso-color-alt:windowtext'><o:p></o:p></span></font></p>

</div>

</body>

</html>