<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1141" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=354321913-05032003><FONT face=Arial color=#0000ff size=2>Two
things.</FONT></SPAN></DIV>
<DIV><SPAN class=354321913-05032003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=354321913-05032003><FONT face=Arial color=#0000ff
size=2>1) Make sure your sproc is looking for LIKE @AccStatus and not =
@AccStatus</FONT></SPAN></DIV>
<DIV><SPAN class=354321913-05032003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=354321913-05032003><FONT face=Arial color=#0000ff
size=2>2) When you use EXEC, you don't add the name of the
parameter.</FONT></SPAN></DIV>
<DIV><SPAN class=354321913-05032003>"EXEC spfrmCustomers
'Active'" </SPAN></DIV>
<DIV><SPAN class=354321913-05032003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=354321913-05032003>
<DIV align=left><FONT face=Arial size=2>Doris Manning</FONT></DIV>
<DIV align=left><FONT face=Arial size=2>Database Administrator</FONT></DIV>
<DIV align=left><FONT face=Arial size=2>Hargrove Inc.</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff
size=2><U>www.hargroveinc.com</U></FONT></DIV></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
dba-sqlserver-admin@databaseadvisors.com
[mailto:dba-sqlserver-admin@databaseadvisors.com] <B>On Behalf Of </B>David
Emerson<BR><B>Sent:</B> Tuesday, March 04, 2003 07:01 PM<BR><B>To:</B>
dba-SQLServer@databaseadvisors.com<BR><B>Subject:</B> [dba-SQLServer]Calling a
Sproc with Parameter<BR><BR></FONT></DIV>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><FONT face=tahoma>@AccStatus varchar(20) =
'%'<BR><BR></FONT>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><X-SIGSEP>
<P></X-SIGSEP>Regards<BR><BR>David Emerson<BR>DALYN Software Ltd<BR>25b
Cunliffe St, Johnsonville<BR>Wellington, New Zealand<BR>Ph/Fax (877) 456-1205
</P></BLOCKQUOTE></BODY></HTML>