473,383 Members | 1,832 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,383 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 4223
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...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.