Advertisement

03.18.2008 at 10:47AM PDT, ID: 23251086
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

Optional Parameters in Stored Procedure Did Not Return Any Records

Asked by lin100 in Microsoft ADP, MS SQL Server, Access Coding/Macros

Optional Parameters in Stored Procedure Did Not Return Any Records.
Access 2002 (SP1) and SQL 2000 Server

I have an ADP form that have a combo box and a text box, and I wanted it to do the following:

1) Whenever a user select a value from a combo box, but leave the text box blank, then Access will    retrieve all of the records that meet the ONE criteria from the combo box.

2) Whenever a user put in a value from a text box, but leave the combo box blank, then Access will
    retrieve all of the records that meet the ONE criteria from the text box.

3) Whenever a user select a value from a combo box, and enter a value in the text box, then Access
    will retrieve all of the records that meet the TWO criteria - one from the combo box, and the
    other from a text box.

Currently, Access only retrieve records when I select a value from a combo box
and ignore the criteria of the text box value.

Example of Error:
combo box value: 100
text box value:  1
Result: Retrieve all records where the combo box value is 100 including records where the
            text box value is 1, 2, 3 or otherwise.

combo box value: 100
text box value:  BLANK
Result: Retrieve all records in the table, regardless of whether or not the combo box
           value is a 100.

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

Form Name: frmParameters_2
Combo Box Name: cboParameter
Text Box Name:  Text_Au_Ord
Where: These 2 controls are located on the Form Header Of  the Form frmParameters_2

Form Name: frmParameters_2
Record Source: byroyalty_2
Input Parameters:
    @percentage int=Forms!frmParameters_2!cboParameter,
    @auord int=Forms!frmParameters_2!Text_Au_Ord

THE TWO PARAMETERS ABOVE ARE OPTIONAL PARAMETERS.
IF NO parameter are given (combo box and text box are blank), then all
records will be displayed on the form frmParameters_2.

Text Box: txtAuID
Where: On the Detail Section of The Form frmParameters_2

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

CREATE PROCEDURE byroyalty_2 @percentage int, @auord int
AS
select au_id from titleauthor
where titleauthor.royaltyper = @percentage OR  @percentage IS NULL
AND titleauthor.au_ord = @auord OR @auord IS NULL
GO

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

Private Sub cboParameter_AfterUpdate()
    Me.Requery  
End Sub

Private Sub Text_Au_Ord_AfterUpdate()
    Me.Requery
End SubStart Free Trial
[+][-]03.18.2008 at 11:58AM PDT, ID: 21154535

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 03:50PM PDT, ID: 21156954

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 04:12PM PDT, ID: 21157094

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.18.2008 at 05:07PM PDT, ID: 21157408

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft ADP, MS SQL Server, Access Coding/Macros
Sign Up Now!
Solution Provided By: lin100
Participating Experts: 2
Solution Grade: B
 
 
[+][-]03.19.2008 at 10:23AM PDT, ID: 21163630

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.19.2008 at 05:40PM PDT, ID: 21167270

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.20.2008 at 01:25PM PDT, ID: 21175502

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628