Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What? Three Chickens? None here mate.

Status
Not open for further replies.

diggingaway

Programmer
Aug 9, 2002
6
0
0
GB
I have a small/large/problem problem.

Whatever. I would like to create a report with a list of primary keys which do not have information in a corresponding field i.e.

SELECT tblBase1.[Primary]
WHERE tblBase1.SECONDARY = ""

FROM tblBase1...

The problem being, that I want to select what I want the field to be every time I open the report. How ? What?

Help is necessary. Chicken.
 
Some of your needs were not clear.. I am assuming you are doing a Stored Procedure in SQL itself..

If so try something like this

CREATE PROCEDURE AccountMasterSelect @AccountNo CHAR (14) AS


SELECT fieldname FROM AccountMaster WHERE AcctNumber = @AccountNo;


Notice the Create procedure has now got a parameter field that expect something to be passed in.. Char (14) state that the size of the text field is 14 charectors.. you could use date, or int for integer or other entries.. if so don't state the size of the field..

then the where clause of the select statement uses this parameter field to give you a variable entry..

Now the question is where you wish to run it from may have a whole different problem of filling the parameter

using qry analyser you just type the stored procedure and the parameter in quotes (unless your parm is a number)

ex: AccountMasterSelect "Mary203"

We access our stored procedures thru VB which has it's own syntax to pass the parameter in.. I could help you with that if you need it, but you could be accessing the data 100 different ways with different syntax I may not be able to help with..
 
That gives me some ideas, hatching away. Thanks for the tip. I'll re-run my SQL code with some of your ideas incorporated. I can see it now...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top