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!

Optional Parameters in Stored Procedure Did Not Return Any Records

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 Sub
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: lin100
Solution Provided By: lin100
Participating Experts: 2
Solution Grade: B
Views: 28
Translate:
Loading Advertisement...
03.18.2008 at 11:58AM PDT, ID: 21154535

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.18.2008 at 03:50PM PDT, ID: 21156954

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.18.2008 at 04:12PM PDT, ID: 21157094

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.18.2008 at 05:07PM PDT, ID: 21157408

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.19.2008 at 10:23AM PDT, ID: 21163630

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.19.2008 at 05:40PM PDT, ID: 21167270

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.20.2008 at 01:25PM PDT, ID: 21175502

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.18.2008 at 11:58AM PDT, ID: 21154535

Rank: Sage

How are you calling this stored procedure?
 
03.18.2008 at 03:50PM PDT, ID: 21156954
To LSMConsulting.

The stored procedure is called whenever I placed a cursor over a combo box to select a different
value or whenever I placed a cursor over a text box to change the value.
Me.Requery will requery the form. The form property is such

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

Whenever Me.Requery is run, the stored procedure byroyalty_2 is activated.

Private Sub cboParameter_AfterUpdate()
    Me.Requery  
End Sub

Private Sub Text_Au_Ord_AfterUpdate()
    Me.Requery
End Sub
 
03.18.2008 at 04:12PM PDT, ID: 21157094

Rank: Sage

I'm not sure that relevant ...

Shouldn't your Proce be this:

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

or perhaps I'm reading this wrong ...
 
03.18.2008 at 05:07PM PDT, ID: 21157408
I am going to close this question since I already have a correct answer.
It is in the stored procedure

CREATE PROCEDURE byroyalty_2 @percentage int, @auord int
AS
select au_id
from titleauthor
where titleauthor.royaltyper = case
   when @percentage is null  then
     titleauthor.royaltyper
  else @percentage
  end
  AND titleauthor.au_ord = case
   when @auord is null then
     titleauthor.au_ord
  else @auord
  end
GO
Accepted Solution
 
03.19.2008 at 10:23AM PDT, ID: 21163630
This question will be deleted since I have already had a solution for it. All 125 points will be refunded.
 
03.19.2008 at 05:40PM PDT, ID: 21167270

Rank: Sage

You must request a deletion through community support. Good luck with your project ...
 
03.20.2008 at 01:25PM PDT, ID: 21175502
New Feature Alert! Please do not make any post of any kind after a Closing or Delete request has been started by the asker unless you have a specific objection. Any post by anyone -- including the Asker -- after the request is made will stop the automated process and force the manual intervention of a Moderator/Admin. So post your comment BEFORE clicking the Delete or Accept And Award Points buttons.

A request has been made in Community Support to close this question:
http://www.experts-exchange.com/Q_23254419.html

If there are no objections, a moderator will finalize this question in approximately 4 days as follows:
PAQ with refund using {http:#a21157408}

Please leave any recommendations here.

Netminder
Site Admin
 
 
03.25.2008 at 05:47AM PDT, ID: 21201331
Closed, 125 points refunded.
Vee_Mod
Community Support Moderator
 
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628