473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Parameter Query

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
5 4215
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
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can...
3
by: thomas goodwin | last post by:
I have a query which asks for a parameter value to execute it. To see the results I have to: a) click on the query -- the "Enter Parameter Value" window pops up. b) enter the parameter value c)...
3
by: cassandra.flowers | last post by:
Hi, I was wondering if it is possible (Using access) to have a query parameter as a drop down box rather than a text box? e.g. typing as criteria for a query produces a box with a text box...
4
by: Andy Davis | last post by:
I have developed a number of reports that are based on parameter queries where the user enters criteria such as a date range and a sales rep say. I want to be able to show a graphical picture in...
1
by: carrionk | last post by:
Hi, I have created a Subform which SourceObject is a parameter query. This is the Query: Qry Name:80IsscomProduct SELECT * FROM Isscomp28 WHERE Like ;
21
by: Marc DVer | last post by:
I am trying to create a query that can be loaded as a querydef object but not having to assign values to the parameters if I don't want to. Normally when using a parameter query in VBA my code...
6
by: tizmagik | last post by:
I am having a lot of difficulty generating a CrossTab Query based report. I have looked online for several tutorials and whatnot but I have not been able to really find what I'm looking for, nor...
2
by: billtubbs | last post by:
Hi I am getting the common problem of the "Enter Parameter Value" dialog box, which pops up every time I execute a query. I built the query using the Expression Builder in Access. If any of my...
20
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.