473,405 Members | 2,444 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,405 software developers and data experts.

Why does my query ask multiple times for each parameter?

sueb
379 256MB
I have the following query:

Expand|Select|Wrap|Line Numbers
  1. SELECT IURs.[Receive Date], IURs.[Procedure(s)], IURs.Category, IURs.[Status Date], IURs.Status
  2. FROM IURs
  3. WHERE (((IURs.[Receive Date]) Between [Start Date] And [End Date]) AND ((IURs.Status) Is Not Null) AND ((IURs.Payer)="SA"))
  4. ORDER BY IURs.[Receive Date];
  5.  
which used to work fine. Recently, it has begun asking for a Start Date, and then an End Date, but then it repeats this once or twice. Once it is satisfied, it seems to collect the correct set of records, but what is going on with it?
Feb 24 '11 #1

✓ answered by NeoPa

This is bizarre!

I found no reason or data corruption anywhere. I tried various approaches, even deleting all data from the table (as well as creating a new table and stripping out all unused fields, creating various new queries pointing to the same and copies of the table). None worked.

I found the fix was to remove the WHERE clause (in the design view worked fine) entry for the Between [Start Date] And [End Date], then simply to re-apply it. What was strange was that I didn't even have to retype it. Simply pasting back in the same text I'd Cut out worked perfectly well.

When I had consistently working, and non-working, versions of the query, I also compared the SQL of each, as well as each of the visible Query properties. I saw nothing different between the two queries at any point.

19 13965
NeoPa
32,556 Expert Mod 16PB
No reason I can see Sue. Are you running it natively? Or is it the .RecordSource for some other object?
Feb 24 '11 #2
If you are using this Query as Record Source for your Report it will ask for the parameter values when you preview the Report. When you change from preview to print it will ask for the parameter values again.
Feb 24 '11 #3
I had this problem and solved it by putting "" around the values I wanted to be shown in the design view of the query. Now it doesn't ask for a parameter. Hope that is possibly helpful!
Feb 24 '11 #4
sueb
379 256MB
NeoPa, it's the recordsource only for the one form. And I'm not sure how to know if I'm running it natively; what would I look at to know that?

Elizabeth Mitte, where did you put the quotes? In the criteria string of the query? Currently, my query looks like this:

Expand|Select|Wrap|Line Numbers
  1. SELECT IURs.[Receive Date], IURs.[Procedure(s)], IURs.Category, IURs.[Status Date], IURs.Status
  2. FROM IURs
  3. WHERE (((IURs.[Receive Date]) Between [Start Date] And [End Date]) AND ((IURs.Status) Is Not Null) AND ((IURs.Payer)="SA"))
  4. ORDER BY IURs.[Receive Date];
  5.  
Where would the quotes go, exactly?
Feb 24 '11 #5
sueb
379 256MB
aprpillai, this query actually supports a form, not a report. And the multiple requests occur before the form is even displayed.

But your statement is curious to me: I've never seen a report ask again for the parameters when I send it to the printer from the preview pane. Why would it do that?
Feb 24 '11 #6
NeoPa
32,556 Expert Mod 16PB
Running natively would be simply opening the query from the database window. It shows the results in simple datasheet format. If you're running it as the .RecordSource of an object (which it seems you are - the form being the object), then, as aprpillai suggests, there is scope for the query to require being run more than once. Less so for a form I guess, but an example would be if either the .RecordSource or the .Filter properties were changed at any time after the form is first opened.
Feb 24 '11 #7
sueb
379 256MB
NeoPa and aprpillai, yes, it does happen when I run the query directly from the database window.

To be clear: I execute the query from the database window, and, sequentially, it asks for the Start Date and the End Date. It does this repeatedly (sometimes up to a total of four times) before opening the datasheet with the requested records.
Feb 24 '11 #8
NeoPa
32,556 Expert Mod 16PB
In that case Sue, I'm at a loss. I have no experience of this type of thing ever happening before. I could only guess at a corrupted database, but that seems unlikely if I'm honest.
Feb 24 '11 #9
sueb
379 256MB
Okay, eeryone, thanks for trying, anyway! If I ever do figure out what's gone wrong with this previously-okay query, I'll post back here.
Feb 24 '11 #10
NeoPa
32,556 Expert Mod 16PB
Sue, If you like I could take a look at it for you. It would involve posting a database that could be tested by me (any relevant back-end data would need to be available of course). I'll repeat the general instructions for posting a database, even though I know you've seen them before :

When attaching your work please follow the following steps first :
  1. Remove anything not relevant to the problem. This is not necessary in all circumstances but some databases can be very bulky and some things do not effect the actual problem at all.
  2. Likewise, not entirely necessary in all cases, but consider saving your database in a version not later than 2003 as many of our experts don't use Access 2007. Largely they don't want to, but some also don't have access to it. Personally I will wait until I'm forced to before using it.
  3. If the process depends on any linked tables then make local copies in your database to replace the linked tables.
  4. If the database includes any code, ensure that all modules are set to Option Explicit (See Require Variable Declaration).
  5. If you've done anything in steps 1 to 4 then make sure that the problem you're experiencing is still evident in the updated version.
  6. Compile the database (From the Visual Basic Editor select Debug / Compile {Project Name}).
  7. Compact the database (Tools / Database Utilities / Compact and Repair Database...).
  8. Compress the database into a ZIP file.
  9. When posting, scroll down the page and select Manage Attachments (Pressing on that leads you to a page where you can add or remove your attachments. It also lists the maximum file sizes for each of the allowed file types.) and add this new ZIP file.
It's also a good idea to include some instructions that enable us to find the issue you'd like help with. Maybe some instructions of what to select, click on, enter etc that ensures we'll see what you see and have the same problems.
Feb 25 '11 #11
sueb
379 256MB
Thanks very much, NeoPa! I'll do that. I'm really puzzled by its behavior, so I'll be curious to see if you can find anything. The query is quite simple, so I'm not averse to simply deleting this one and re-creating it (on the assumption that you're right about some little corruption somewhere), but I'd really love to know if there's actually something incorrect.
Feb 25 '11 #12
NeoPa
32,556 Expert Mod 16PB
One of the things I certainly plan to do is to delete and recreate the main elements of the problem. Probably the tables and the query. Whether or not the new versions exhibit the same properties in this regard as the old, is something I'd like to know.
Feb 25 '11 #13
NeoPa
32,556 Expert Mod 16PB
This is bizarre!

I found no reason or data corruption anywhere. I tried various approaches, even deleting all data from the table (as well as creating a new table and stripping out all unused fields, creating various new queries pointing to the same and copies of the table). None worked.

I found the fix was to remove the WHERE clause (in the design view worked fine) entry for the Between [Start Date] And [End Date], then simply to re-apply it. What was strange was that I didn't even have to retype it. Simply pasting back in the same text I'd Cut out worked perfectly well.

When I had consistently working, and non-working, versions of the query, I also compared the SQL of each, as well as each of the visible Query properties. I saw nothing different between the two queries at any point.
Feb 25 '11 #14
NeoPa
32,556 Expert Mod 16PB
Just to explain :

I originally posted this response in one of your other threads, after the instructions you left there seemed to indicate this was the problem I should be looking at. Having worked on both threads I found it simple to confuse one with the other.

Anyway, this latest post is a response that should be in this thread (so I've moved it across). I will have another look at the other thread, but you may find your notification indicating there is a reply there which is not there any more.
Feb 25 '11 #15
sueb
379 256MB
Well, once again you're right, NeoPa!

Removing and replacing that text made it work correctly again. How ever did you even stumble on this?? What made you think of trying that?
Feb 28 '11 #16
NeoPa
32,556 Expert Mod 16PB
When objects are creeated based on text strings (as queries are) they sometimes get out of synch, so a reboot fix is to type the string in again. In this instance it worked ;-)
Feb 28 '11 #17
sueb
379 256MB
Wow. So that's something I'll tuck away to remember for future bizarre query problems. Thanks, NeoPa!
Feb 28 '11 #18
JDyer
1
There are cases where this occurs when the parameter criteria is not used with the Where for the fields used with your params.
Dec 28 '12 #19
NeoPa
32,556 Expert Mod 16PB
I'm afraid that you seem to have the wrong end of the stick entirely. That is clearly not the issue in this case, as has already been demonstrated by the existing posts in the thread.

We don't have rules against resurrecting old threads per se, but please read through them before offering advice that may be inappropriate, as this seems to be. Bear in mind also that a picture of the query in design view is not too helpful when much of the information is truncated. Typically we use the SQL of a query as that encapsulates all the logic completely.

The issue here was found to be a glitch or corruption in the database, and not related to any faulty SQL. When the SQL was re-applied, exactly as it was originally, it worked fine. Clearly there was nothing wrong with the original SQL itself.
Dec 29 '12 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: pb648174 | last post by:
I have a single update statement that updates the same column multiple times in the same update statement. Basically i have a column that looks like .1.2.3.4. which are id references that need to...
1
by: Luther Miller | last post by:
I've created a web setup project that works great for installing an ASP.NET application to a virtual directory on a server. I'd like to be able to use the same setup program to install multiple...
9
by: james.e.coleman | last post by:
Hello, I have created a custom dropdownlist that is used multiple times within a single page. When trying to set the values of the controls with the page in which they are being used, they all...
0
by: Jonathan Duke | last post by:
I have written a custom session state provider that stores session data in XML in a SQL database , and I was running the SQL profiler to verify that all of my stored procedures were called in the...
22
by: Brett Romero | last post by:
If my UI app uses three DLLs and two of those DLLs reference something named utilities.dll, does the UI app load utilities.dll twice or does the compiler recognize what is going on and load...
0
by: ghetto_banjo | last post by:
I have a report with sub-reports that is based on a query that has a parameter. I also have a table which is simply a list of values I would like to use for the parameter. I would like to create...
6
by: yk | last post by:
Hi, Is it a technique available in html/javascript in order to display same image many many times on a same page? Because of a large page loading I am looking for a way not to have same...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
15
by: wizofaus | last post by:
I have a chunk of code which is essentially IDbCommand cmd = db.CreateCommand(); cmd.CommandText = "SELECT X, Y, Count(*) FROM Foo WHERE Z = 1 GROUP BY X, Y"; using (IDataReader reader =...
1
by: mike_boghossian | last post by:
Good morning, I am a relatively novice access user. I was given the grand assignement yesterday of outputting queries for a sales organization to excel and repeating this once a week. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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,...

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.