473,394 Members | 1,893 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,394 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 4226
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.