Monday, March 26, 2012

Parameter Entry on a report

I'm trying to graduate from Access to SQL and am finding that Access is still meeting my needs better than SQL.

So, I figure I'm doing something wrong.

In Access, I have queries that contain parameters. So far, I've gotten SQL to accept parameters, using =@.prompt. But, this seems to be a limited parameter capability. Number one, I can't use a phrase for a prompt. Number 2, I can't do something like Access' Between [upper] And [lower]; I've not found away to use parameters as bounds in SQL.

Any help?

In your SQL query for

Between [upper] And [lower]

You need to do something like

SELECT MYPARAMETER FROM MYTABLE WHERE STARTDATE BETWEEN @.StartDate AND @.EndDate

What do you mean by

Number one, I can't use a phrase for a prompt

If you mean that you can't enter text into a parameter, you need to declare the parameter to be varchar.

|||

Hmm.

I have to enter it as SQL code, not in the builder like I used to for Access?

I am a major novice at SQL, having used Access' query builder forever.

On the "phrase for a prompt" part, I meant something like, =@.Enter Start Date:.

|||

I think you can use query builder, but I've never used it. I just write the SQL query.

|||Perhaps you've already looked at these but here is a good basic good tutorial about parameters:

http://msdn2.microsoft.com/en-us/library/aa337432.aspx

|||Thanx, mrtrombone! I think that will help a lot.

No comments:

Post a Comment