Problem Changing Query Criteria

Jul 17, 2006

I was wondering if anyone could throw some light on a problem I'm having. I have a straightforward report - record source is a query. The query has some selection criteria which requires input at run time. This works fine ! (Why change this you ask ? I'm beginning to ask myself the same question- but hey !)

The problem occurs when I change the criteria in the query (original requested input of a parameter field - the new criteria points at a combo box on an unbound form). If I then run the report, it asks for 'both' sets of criteria (old and new ) !

I've tried copying both the query and the report (thinking that the original criteria are somehow being stored somewhere ), but I'm still getting the problem.

I guess I'm missing something straightforward but I just can't see it.

Cheers

Steve

View Replies


ADVERTISEMENT

Changing The Criteria On A Query Via A Form

Aug 25, 2005

Hi

Not sure if this is in the right forum. :confused:

But here goes, my question is;

Is it possible to update the criteria by using a form?

What we are looking to accomplish, is a report that prints out labels in relation to the customers that are chosen in the query. What we want the user to be able to enter multiple Company ID's on this form, which are then picked up by the query and the companies name and address printed out via the report.

The printing out of the report from the form we have done.

View 1 Replies View Related

Changing Criteria In A Query Using A Form

Jun 22, 2006

Hello,

I am working on a database which has many queries that count different statistics of clients (race,gender,ect) during specific date ranges. I would like to set up a form that you could go in and enter a date range into a text box and it would update the criteria (date range) for each of the queries. How would this be possible? I have looked at some past threads similar to this but they didn't help.

Any help will be greatly appreciated.

View 5 Replies View Related

Queries :: Query Changing Criteria On Its Own

Dec 16, 2014

I have a query, and in order for it to run properly, I've set it to look in an unbound combobox on a form to display the necessary data I want, as long as I never close down the form, this is exactly how I want it.However, if I close this form down, and reopen it, I'm asked by messagebox to get the lookup from a different form's combobox, despite saving the correct form's design over and over again, and saving the actual query, more than once, while in design view.when Access changes the criteria, there isn't even a combobox value on the form it changes to.

View 3 Replies View Related

Modules & VBA :: Changing Query Criteria

Jul 22, 2015

I have a query, "adhocComplete" that has criteria ">=[Forms]![frmAdhoc].[Date] And <=[Forms]![frmAdhoc].[Date2]" for the field [30DayDue].Is there a way of removing the criteria from the query by unchecking a checkbox [Check62] on the form [frmAdhoc] and re-adding the criteria if the checkbox is check?

Code:
Dim qdf As DAO.QueryDef
Dim qdfOLD As String
Set qdf = CurrentDb.QueryDefs("Query1")

[code]....

View 8 Replies View Related

Modules & VBA :: Changing Every Value With Multiple Criteria

Jun 7, 2013

I made this code in excel, and I'd want to get it working in access.

Sub Satunnaisluvut()
Dim OmaAlue As Range
Dim Solu As Range
Set OmaAlue = Range("A1:A5")
For Each Solu In OmaAlue
If Solu.Value = "aa" Then
Solu.Value = "bb"
End If
Next Solu
End Sub

How do i set the wanted field? And how about the loop?

View 3 Replies View Related

Setting Query Criteria To Be 'blank' Depending On The Criteria Of A Combo Box

Oct 21, 2006

I have set up a database that stores actions (i.e jobs). In the table; two of the fields are...'required completion date' and 'actual completion date'. I wish to lookup, by using a query, all of the open actions (those which havent yet been complete (i.e the 'actual completion date' is null)) and then later on all those which are overdue (i.e the 'actual completion date' is null And the 'required completion date' <today....this being the criteria for an overdue action).

However, I have used a form which has a combo box which contains the values open and overdue. When a selection has been made I want a form to display with the results depending on the selection that has been made. I am capable of creating a form based on a query, but am unsure of how to construct the query with the correct criteria based on the option that is selected from the form.

Any help would gratefully be appreciated. Thanks

View 5 Replies View Related

How To Query Data For Specific Criteria - Criteria Help

Aug 20, 2007

I have data for hundreds of stores. The data was pulled for the top 15 items by store, so I cannot obtain only the top 5 items that I need. How can I query this data to extract only the top (or bottom) 5 Subjects, by store, based on the percentage column?

StoreSubjectSalesSales %
1516Fiction56431.5-24.15%
1516Audio Unabridged1650.8-231.04%
1516History / Military History10081.1-29.99%
1516Role Playing / Graphic Novels14773.9-20.27%
1516Mystery13152.6-19.84%
1516Audio Abridged1785.9-141.84%
1516SciFi / Fantasy27535.3-7.93%
1516Juv Audio/Video1580.6-100.13%
1516Biography8103.6-15.89%
1516Sports7910.8-15.64%
1516Current Affairs / Law8141.9-14.34%
1516Reference7183-16.22%
1516Juv Non-Bk4585.9-25.02%
1516Science / Tech2961.4-33.98%
1516Movies / TV / Music / Dance3395.3-29.46%
1872Fiction307344.3-7.49%
1872Business134307.5-13.48%
1872Psych / Self Improvement100650.4-10.05%
1872Audio Unabridged29165.9-27.32%
1872Cookbooks57463.3-13.56%
1872Computers59235.7-12.37%
1872Regional59883.4-11.22%
1872Health & Fitness64713.8-10.29%
1872Maps19358.4-27.66%
1872Current Affairs / Law47927.1-11.08%
1872Travel Foreign42583.7-12.27%
1872Religion / Bibles80255.6-6.07%
1872SciFi / Fantasy67641.4-6.49%
1872Study Aids / Notes38299-11.24%
1872Games41745.1-9.79%

View 2 Replies View Related

Changing A Query....

Oct 9, 2005

in my assignment, I am told to change my prior query by continuing to display the sum, average, and pledge numbers. what is required, is for me to display these totals by the names of the pledges, not just a grand total. how can I sort the query by name?

View 1 Replies View Related

Changing The Name Of A Query From A Form

Feb 8, 2005

OK…procedurally I know I am probably doing this wrong, but that is the way the database is set up…so let me try to explain.

Query A has the same fields as Query B. Query B has two fields which are parameter values (i.e. when you run the query, Access prompts you to enter two values). Query A gets these values from a table.

The process I have for getting a report depends upon whether I wish to hard code the values of the report in, or whether I wish to use the information from the table that Query A uses.

Depending upon my choice I end up renaming Query A or Query B to Query C.

All of my subsequent queries utilize the information in Query C to make the necessary calculations and data massaging in order to spit out a Report.

What I would like to do is have a toggle control/radio button (on a form), which will rename Query A to Query C or Query B to Query C, depending upon which choice I click on the toggle button.

My issue is I do not know how to change the name of a Query in VBA. I tried to look up how to do it using [DoCmd.RunCommand acCmdRename], but I couldn’t find any examples which would help and don’t even know if this is how I should go about renaming these queries.

I hope I’ve explained myself correctly… Does anyone have a clue as to how I could do this?

Thanks in advance…
Gary

View 4 Replies View Related

Changing The Table In A Query

Feb 11, 2005

Hello,

I have a query that I want to run for multiple tables of the same structure. Instead of creating a query for each table, is there any way that I can write some code or SQL statement that will change the table that the query is using? Thanks!

G

View 6 Replies View Related

Queries :: Changing Value Of SQL In Query

Apr 9, 2015

So I have created a select query and I am using it as an all purpose search query. I plan on changing the value of SQL in the query based upon what the user selects as the method of searching. So there is a drop down menu, that allows the user to select the method, this will be expanded in the future but for now till I get this working I am not going to bother with that. That being said, I figure once I get a couple of these the work the others should follow suit. Anyway, here is what I have so far.

Code:
Dim StrSQL As String
Dim qdf As DAO.QueryDef
Select Case Me.Combo3

[code]...

View 6 Replies View Related

Changing Navigation Recordsource To Query

Apr 10, 2006

Hello,

I'm trying to create navigation buttons that navigate in alphabetical order. I know that the easiest way to do this is by creating a query and using the query as the recordsource for my navigation buttons, but for the life of me I cannot figure out how to actually change to the recordsource to that query for only that navigation button.

I'd appreciate any help

Thank you
PRHC

View 2 Replies View Related

Changing The Subform/query On A Form

Jan 13, 2005

Hi,

I have a form that has a query on it. It acts as a subform. I would like for this query to be able to switch depending on what employee I've got selected on the form. I've tried playing around with the sourceobject property:

Dim name As Variant

name = Forms![Time Input Form]!Employee
Forms![Time Input Form]!Table.SourceObject = name


, but it keeps telling me
"Run-time error '3011':
The Microsoft Jet database engine could not find the object
~sq_cTime Input Form~sq_cTable'. Make sure the object exists and that you spell its name and the path name correctly."

The names directing to the subform are absolutely correct though. I'm just not sure if this is the right property to use.

Anyone have any ideas? Thanks. =)

View 1 Replies View Related

Changing A Field Value For All Records In A Query

Mar 9, 2006

I have a query that pulls records from a main table based on a check box and I need a macro or code that will set the field value as if it were unchecked.

BTW I am self-taught and new at this so don't make fun of me if the question seems stupid.

Thanks!

View 8 Replies View Related

Changing Query To Show Null Values

Jun 26, 2006

Hi,
This query will allow me to view payments that are made between 2 dates. I would like to know how to flip the query around so that it gives me the payments that have not been made. I think this would be described as returning the null values?

The SQL code i have at the momnet is:
SELECT download20060602.Date, download20060602.Description, download20060602.Amount, Members.FirstName, Members.[Mid Name], Members.Surname, Members.[Memb No]
FROM Members LEFT JOIN download20060602 ON Members.description = download20060602.Description
WHERE (((download20060602.Date) Between [Enter Start Date] And [Enter End Date]));


Any help or ideas would be fantastic.

Cheers
Phill

View 3 Replies View Related

Changing Data Source (table) For A Query

Jul 18, 2006

Hi,

I have two Tables TA and TB. I have a set of queries based on TA. I want to substitute TB for TA (i.e. TB will stand in place of TA). I want the old TA queries remain unchanged but now be based on TB.

If I delete TA and then rename TB into TA, I will lose the queries. Therefore I want to 'point' the queries (in the most efficient way) to TB instead of to TA.

Then I can delete TA. Then I can rename TB into TA and the queries will follow along, I expect.

I have been trying in vain to find a way of pointing the queries to TA instead of TB? How do I do it?

I have done it with Forms (Design Views, Properties), where I can select a datasource. But where is the corresponding thing enabling me to select a datasource for Queries?

Thanks.

Adrian

View 13 Replies View Related

Changing Table Source In Query Using Vb Instead Of Manually Doing It.

Aug 17, 2004

I have a Query called Median and all it does is pulls all the fields and all the records from 1 table. Since the Query is connected to a lot of other queries, and the table it's connected to changes twice a month, I was wondering if there was a way to set this up in a form maybe using vb, so a user could maybe Click a new table from a combo box list of current tables in the database, then click a button that says "Change", and it change all the fields to the new table and removes the old table from the query.

Or what might be better is: Already on the form, i have part of the name of the new table already entered by the user (it bases the new name of the new table off this text box). So, what I can use is the Text in that box and an & " the rest of the tablename", and automatically change the table in the Median Query based on that criteria. If that is too complicated, then a combo box will be sufficient.

Another way i guess, would be to setup a hidden field that takes whatever's in my text box (which is a date) and adds " the rest of the tablename", then I could base the replacement table of the Median on that one text box.

Anyway, is there a way to do this?

View 6 Replies View Related

Queries :: Changing Text To Hyperlink In Query

May 7, 2014

I was trying to see if there is a way to convert text to a hyperlink in a query.

Background : I'm pulling information from a lotus notes database using an OBDC connection and storing it into an access database and using that to upload to a sharepoint site. While we are converting over to a sharepoint site, I was trying to make it easy to get back to the original site for each document to check the work.

One of my columns in the query looks like this:

Code:
Notes Link: "notes://pncpgha66/852570CE0056FEF3/0BFCC83A5C11D7C3852576CD0072ED3E/" & [NoteUNID]

I don't see a way to convert that whole part to a hyperlink though. Like I could with a date and text. Cdate().

View 1 Replies View Related

Queries :: Update Query Not Changing All Records?

Apr 24, 2013

i have an update query that looks for a product number, updates the cost, and re-calculates the price in two columns based on the salesman's margins. the problem i am having is that it seems to be hit and miss on the first run. if you run it again, it runs the calculations on all the fields. (it has to check / recalculate 16,000 rows.) should this query have vba to make it loop thru the table.

here is the basic layout of the query:

table 1 is newproductq
table 2 is Products
Field: PriceIn
Table: newproductq
Update To: [Products].[Cost]
UNITS
newproductq
[PriceIn]/((100-[Margin])/100)
PIECES
newproductq
[PriceIn]/((100-[BrokenMargin]/100)

View 4 Replies View Related

Changing Recordsource Then Go Back To Original - Query Is Faster

Oct 11, 2006

Hi
I have some drop downs on my form, which has some code that decides which recordsource to use.
When I first select an option from the drop down, the query takes 10 seconds to load data.
I then select another option, which runs a different query, which takes x seconds.
If I then select the original option from the dropdown, the data loads onto the form in less than a second.

Why is there a delay the first time round and not the next? Has Access saved some kind of query plan? If so, why doesn't it save it permanently?

View 1 Replies View Related

Queries :: Changing Field Format In Append Query

Dec 3, 2014

I am using an append query to move data into another database. One of the fields being imported is a date field in text form (20141201). I need it appear in the final database in text form (01/12/14) I have tried using several date conversions and cant get this work. Ideally i need the final value as a text rather than date.

View 8 Replies View Related

Queries :: Dates Not Changing - Incomplete Query Clause

Jan 17, 2014

I have a date field NxtAPayDate that I need to update to the same day in the next calendar quarter. I have an update query set up using DATEADD but it does not change the dates. The table name is AutoPay

I am using the Query Design Grid. This is the SQL code behind the query:

UPDATE AutoPay SET AutoPay.NxtAPayDate = DateAdd("q",1,[AutoPay]![NxtAPayDate]);

When I view the results the dates are the same - original dates, when I try to sort the results, I get a message box with the following: syntax error, incomplete query clause?

I cannot get the dates to change by using a specific date either

UPDATE AutoPay SET AutoPay.NxtAPayDate = #1/2/2014#;

View 1 Replies View Related

Queries :: Changing Query In VBA Not Working With Calculated Dates?

Sep 9, 2013

I am trying to run a change an existing query in real time to allow date filtering for 4 different categories. I can get two of them to work. Calibration Date and Icepoint Date. But for The two calculated fields Calibration due date and Icepoint date I cannot get it to filter properly e.g. for 2013 dates it also includes 2014 dates and just does not work properly. I am thinking its due to it being a calculated field but don't have a clue how to fix it. see pasted code for calibration due date filter where Todate and Fromdate are the 2 dates used. I also have the on current code and the exit code to reset the query to its original status.

Public Sub SetDate1()
'Apply date filter and rebuild query in real time
On Error GoTo Err_SetDate1
If IsNull(Me!ToDate) And IsNull(Me!FromDate) Then
MsgBox ("Please Enter Date First"), vbExclamation
GoTo Exit_SetDate1

[code]....

View 3 Replies View Related

Modules & VBA :: Email Query - Changing FROM ID If Have Multiple Accounts?

Aug 5, 2013

How do I change the account from which to send the email if I have multiple accounts, or can I?

View 14 Replies View Related

Forms :: How To Force Execution Of A Query When Changing Record

Jul 13, 2014

I have the following tables:

Supplier
Supplier# [Other columns]

Material
Supplier# Material# [Other columns]

DeliveryHeader
Delivery# Supplier# [Other columns]

DeliveryDetail
Delivery# Supplier# Material# [Other columns]

I've created a form based on table DeliveryHeader with a subform based on table DeliveryDetail. The two are linked by Delivery# Supplier#.

On the form, Supplier# is a combobox that lists all suppliers from table Supplier.
On the subform, Material# is a combobox that lists only the materials supplied by the supplier selected with form's Supplier#.

The problem is that this second list always shows the materials of the first listed supplier. For instance, when the form is loaded, it shows delivery #1 with all its details on the subform. Suppose supplier loaded to form is #1.

1) If I use subform combobox, it shows correctly supplier's #1 materials. But then, whatever delivery I navigate, it always shows supplier's #1 materials.

2) If I navigate to another delivery without using subform combobox, suppose I stop on a delivery where the supplier is #4, then subform combobox shows correctly supplier's #4 materials. But then, once again, whatever delivery I navigate, it always shows supplier's #4 materials.

I've spread Me.Requery here and there but without any success. What trick must I apply to force the execution of the query of the subform combobox Material# each time I navigate to a new record on the form?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved