473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4281
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(Ye ar(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******@examp le.invalid> wrote in message
news:hZ******** **************@ bgtnsc05-news.ops.worldn et.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(Ye ar(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.4321 21$275.1303213@ attbi_s53...
works this way but when I hard code 6 and 30 in criteria field, it fails???
"fredg" <fg******@examp le.invalid> wrote in message
news:hZ******** **************@ bgtnsc05-news.ops.worldn et.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(Ye ar(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.1538 86$_M.726684@at tbi_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.4321 21$275.1303213@ attbi_s53...
works this way but when I hard code 6 and 30 in criteria field, it

fails???

"fredg" <fg******@examp le.invalid> wrote in message
news:hZ******** **************@ bgtnsc05-news.ops.worldn et.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(Ye ar(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.153 389$_M.725939@a ttbi_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
16940
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 create a parameter query in a stored procedure, but how do I use the result set of a parameter query in a select query (in the same or another sp)? In short, if a select query contains a result table that is generated as a parameter query, how do I...
3
3118
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) look at results in datasheet view If I want to run the query again, I must d) click to close the datasheet view e) click on the query f) enter the parameter value
3
1011
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 for you to enter the parameter. Can any body enlighten me on how to turn this text box into a drop down box? And whether it is possible?
4
5715
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 the form of a bar chart based on the data within the report. Can I do this as when I have tried to insert a chart on the report it displays an error saying that it doeds not recognise the parameter criteria. Am I right to assume that maybe a chart...
1
2575
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
5752
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 would go something like this: dim qry as dao.querydef set qry = currentdb.querydefs("myquery") qry.parameters("Par1") = "blah"
6
4460
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 have I been able to adapt other people's solutions/tips to fit what I need. If anyone could please help me with the following it would be really appreciated, thank you! I need to generate a Report (say: repCrossTab) that grabs it's data from the...
2
3261
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 expressions reference another column in the same query, it causes the dialog box to appear for each parameter before displaying the query output, even though no parameter values are required. For example, here are four expressions in my query: ...
20
5217
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 write the parameter, I want to select a row from the listbox and after clicking in a button, the query to automatically take the current value of listbox as the needed parameter and then to load the query. (The Inputbox for "Enter Parameter" will...
0
8330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8626
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.