By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,660 Members | 1,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,660 IT Pros & Developers. It's quick & easy.

Parameter Query

P: n/a
MX1
Simpler way to ask question from my previous post. I wrote a query and it
has a paramter field in it. I want to enter a date with the current year.
If it I put in 6/30/2003, it works great. If I put in some kind of a
variable based input for the parameter like '6/30/' & year(now()), it
doesn't work. Is there any way to concatenate text and a variable at the
input of a parameter query. THIS IS DRIVING ME NUTS. PLEASE HELP. :)
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
MX1 wrote:
Simpler way to ask question from my previous post. I wrote a query and it
has a paramter field in it. I want to enter a date with the current year.
If it I put in 6/30/2003, it works great. If I put in some kind of a
variable based input for the parameter like '6/30/' & year(now()), it
doesn't work. Is there any way to concatenate text and a variable at the
input of a parameter query. THIS IS DRIVING ME NUTS. PLEASE HELP. :)


WHERE YourTable.ADate <=DateSerial(Year(Date()),[EnterMonth],[Enter
Day])

When prompted, enter a 6 for the month, a 30 for the day.
Will return all records <= 6/30/200X whatever the current year is.

--
Fred
Please reply only to this newsgroup.
I do not respond to personal e-mail.
Nov 12 '05 #2

P: n/a
MX1
works this way but when I hard code 6 and 30 in criteria field, it fails???

"fredg" <fg******@example.invalid> wrote in message
news:hZ**********************@bgtnsc05-news.ops.worldnet.att.net...
MX1 wrote:
Simpler way to ask question from my previous post. I wrote a query and it has a paramter field in it. I want to enter a date with the current year. If it I put in 6/30/2003, it works great. If I put in some kind of a
variable based input for the parameter like '6/30/' & year(now()), it
doesn't work. Is there any way to concatenate text and a variable at the input of a parameter query. THIS IS DRIVING ME NUTS. PLEASE HELP. :)


WHERE YourTable.ADate <=DateSerial(Year(Date()),[EnterMonth],[Enter
Day])

When prompted, enter a 6 for the month, a 30 for the day.
Will return all records <= 6/30/200X whatever the current year is.

--
Fred
Please reply only to this newsgroup.
I do not respond to personal e-mail.

Nov 12 '05 #3

P: n/a
MX1
More specifically, when I try to pass the following value in the parameter
query prompt, it works:

DateSerial(Year(Date()),6,30)

When I try to pass it as a value from a form combo box that feeds a
parameter query, it fails. Maybe I need to wrap it around something else
when passing from a form to query?
"MX1" <mx*@mx1.abc> wrote in message
news:agJEb.432121$275.1303213@attbi_s53...
works this way but when I hard code 6 and 30 in criteria field, it fails???
"fredg" <fg******@example.invalid> wrote in message
news:hZ**********************@bgtnsc05-news.ops.worldnet.att.net...
MX1 wrote:
Simpler way to ask question from my previous post. I wrote a query and
it
has a paramter field in it. I want to enter a date with the current year. If it I put in 6/30/2003, it works great. If I put in some kind of a
variable based input for the parameter like '6/30/' & year(now()), it
doesn't work. Is there any way to concatenate text and a variable at the input of a parameter query. THIS IS DRIVING ME NUTS. PLEASE HELP.

:)


WHERE YourTable.ADate <=DateSerial(Year(Date()),[EnterMonth],[Enter
Day])

When prompted, enter a 6 for the month, a 30 for the day.
Will return all records <= 6/30/200X whatever the current year is.

--
Fred
Please reply only to this newsgroup.
I do not respond to personal e-mail.


Nov 12 '05 #4

P: n/a
MX1
Actually, I put DateSerial(Year(Date()),6,30) in the criteria box of the
query's design view and it works. When I paste it into the parameter
dialogue box when query prompts for input, it fails. I don't think the
parameter field knows how to process the variable first and then run. Looks
like it is taking it as a literal...
"MX1" <mx*@mx1.abc> wrote in message
news:TqJEb.153886$_M.726684@attbi_s54...
More specifically, when I try to pass the following value in the parameter
query prompt, it works:

DateSerial(Year(Date()),6,30)

When I try to pass it as a value from a form combo box that feeds a
parameter query, it fails. Maybe I need to wrap it around something else
when passing from a form to query?
"MX1" <mx*@mx1.abc> wrote in message
news:agJEb.432121$275.1303213@attbi_s53...
works this way but when I hard code 6 and 30 in criteria field, it

fails???

"fredg" <fg******@example.invalid> wrote in message
news:hZ**********************@bgtnsc05-news.ops.worldnet.att.net...
MX1 wrote:

> Simpler way to ask question from my previous post. I wrote a query and
it
> has a paramter field in it. I want to enter a date with the current

year.
> If it I put in 6/30/2003, it works great. If I put in some kind of a > variable based input for the parameter like '6/30/' & year(now()), it > doesn't work. Is there any way to concatenate text and a variable
at the
> input of a parameter query. THIS IS DRIVING ME NUTS. PLEASE HELP.

:) >
>

WHERE YourTable.ADate <=DateSerial(Year(Date()),[EnterMonth],[Enter
Day])

When prompted, enter a 6 for the month, a 30 for the day.
Will return all records <= 6/30/200X whatever the current year is.

--
Fred
Please reply only to this newsgroup.
I do not respond to personal e-mail.



Nov 12 '05 #5

P: n/a
"MX1" <mx*@mx1.abc> wrote in message news:<jzIEb.153389$_M.725939@attbi_s54>...
Simpler way to ask question from my previous post. I wrote a query and it
has a paramter field in it. I want to enter a date with the current year.
If it I put in 6/30/2003, it works great. If I put in some kind of a
variable based input for the parameter like '6/30/' & year(now()), it
doesn't work. Is there any way to concatenate text and a variable at the
input of a parameter query. THIS IS DRIVING ME NUTS. PLEASE HELP. :)


not as far as I know... You could do this with an unbound form with
the text field's format set to some kind of date. Then entering a
month-day combination will assume the current year. Otherwise, you
would have to do something like manipulate the date entered in your
textbox in code and then pass that as a parameter to your query using
the parameters collection of the querydef object.
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.