Queries :: Less Than Parameter In Query Works Except When Value Is 100

Jun 27, 2014

I have a query that checks a table where there's a field that only has numbers from 0 to 100 (a grade), let's call that field "average" (note, the values 0 to 100 are actual numeric values, not percentages)

here's the problem:

when I filter the query using a parameter like <[value] on the average field, the query does show the expected records that have an average value that is less than the value that I input when prompted... except that it also includes the records on which the average field is 100 ... ... for some uknown reason.

to clarify:it won't show anything over the imput value, it just shows anything under the value I imput (good) and anything that has an average of 100

when I hard code the value for the parameter say <65 the query gives me the results expected (anything less than 65 in the average field) without including records with average equal to 100

some details:

the average field has this code: Average: CInt(Nz([Grade]))

the query looks like this:

SELECT [All Classes P1 Query].Class, [All Classes P1 Query].[Student ID], [All Classes P1 Query].[Full Name], [All Classes P1 Query].Subject, CInt(Nz([Grade])) AS Average, [All Classes P1 Query].Qualification, [All Classes P1 Query].[Student - Class - Grade].[Class Grading Period]
FROM [All Classes P1 Query]
GROUP BY [All Classes P1 Query].Class, [All Classes P1 Query].[Student ID], [All Classes P1 Query].[Full Name], [All Classes P1 Query].Subject, CInt(Nz([Grade])), [All Classes P1 Query].Qualification, [All Classes P1 Query].[Student - Class - Grade].[Class Grading Period]
HAVING (((CInt(Nz([Grade])))<[value]));

I'm on access 2007

View Replies


ADVERTISEMENT

Queries :: ODBC Call Failed On Query But Form Works

Aug 7, 2013

When running a query in Access 2013 or 2010 we get an ODBC call failed. However when we run just the form, which the query connects to, it works just fine.

View 3 Replies View Related

Queries :: Insert Works In SQL VIEW But Not In VBA?

Mar 5, 2014

This code:

Code:
Private Sub txtPart_LostFocus()
Dim db As Database
Dim strSQL As String

[Code]....

But no entries are added to the table.

I open a query in design mode, paste the first debug above in SQL VIEW and run it:

Code:
INSERT INTO tblPartSpecs (PartID, SpecID, Sequence) VALUES (19, 14, 1);

And the entry is added in the table.

PartID and SpecID are long integer, Sequence is integer.

I originally had Me.txtKey in the SQL, but I saw a comment in a post about that being a possible culprit. So I copied it into a long integer, still didn't work (latest trial above).

View 2 Replies View Related

Queries :: Don't Want Parameter In Query

Apr 25, 2013

I have a table that has a date column. I am assigning one group of students a test date of 4/29 and another group 4/30. I don't want access to change the column or ask for a parameter during the query, but no matter what I do, it keeps asking me for a parameter. I just want it to use the data that is already in the column.

I tried changing the column name in Excel to DOT from Date. That didn't work.I also tried changing the column to text, so that it wouldn't be a "date." That didn't work.

View 7 Replies View Related

Queries :: Two Number Parameters - OR Works But AND Gives Zero Result

Aug 16, 2014

I made a query that requires to enter two parameters (both are Number data type). I need the 2 parameters to be a criteria in the same row (AND). When I run the query it gives me zero result (and the data is already exists in the table). What is the mistake?

View 10 Replies View Related

Queries :: Calculation Only Works If Field Have Values

Jun 23, 2015

I have a calculated field in a query. The calculation only works if the fields have values. This is what I used a the calculation:

PrimaryShareTotal: [Primary1Share]+[Primary2Share]+[Primary3Share]+[Primary4Share]

I tried using the Nz command

PrimaryShareTotal: Nz([Primary1Share]+[Primary2Share]+[Primary3Share]+[Primary4Share])

but this doesn't work.

View 1 Replies View Related

Queries :: Set Parameter As First Value From Separate Query

Aug 11, 2015

I have multiple queries that I need to have filered by the same parameter (Client). There is a list of clients that receive this report (the report has a pre-made template with multiple tabs, hence the multiple queries).

Currently the user of the database has to filter the exported excel file for each client re-save and email basied on the client. The above is done when the user pushes the specified button on a form (which just says run report a on it).

I am trying to figure out how the write a code so that a parameter (or table if that would work better) pulls the first record of the Client query to filter the other queries being run. Then to loop that process with the second record and so on through the Client query until all the clients have had the report run for them.

Attached are the current VBA being used and the current SQL for the first query that needs the parameter value added.

View 1 Replies View Related

Queries :: Report Value As Parameter In Query

Oct 24, 2013

can i set a value in report as parameter in query

View 1 Replies View Related

Queries :: Using Like Criteria In Parameter Query

Aug 10, 2013

It is possible to create a parameter query in Access that will search for records that match the parameter entered by the user AND contain all other records that have that value plus other text.

For instance you may want Access to return all records that begin with the letter Q.

To do this you need to enter the following expression into the criteria row:

Like [Find records beginning with:] & "*" Or Is Null

The user can enter a Q and the criteria concatenates the wildcard character * to this parameter value, to find all text strings that begin with a Q.

By also using Or Is Null in the criteria the user can enter a blank value into the parameter query to return all records, even if this field is blank.

But how do I search if i want all the records with John anywhere in the field???

View 5 Replies View Related

Queries :: Combo Box Query Parameter

Aug 27, 2013

I have a query where I want to use a combo box in the parameter. However, its not working.

SELECT Call_Details.Emp_ID, Call_Details.[Call Status]
FROM Call_Details
WHERE (((Call_Details.Emp_ID)=[Forms]![TTY_ID]![TTY_ID]));

I get this in the Parameter Value Dialoge

Forms!TTY_ID!TTY_ID

Should I be entering this in the criteria field at all? Do I have to build an event to make this work?

View 3 Replies View Related

Queries :: How To Use Combo Box For Query Parameter

Oct 30, 2013

I need to apply a parameter to a query based on from combo box. I have added the ALL option to the combobox which that the user would select if they want to run the query to show all records;

E.g. Selecting ALL Countries would be the same as having no parameter or a wild card *

ALL Countries
UK
United States
Asia
Europe

I tried an iif statement like:

IIf([forms]![frmSelectReports].[location]="AllCountries",like"*",[forms]![frmSelectReports].[location])

but it didn't work...

View 2 Replies View Related

Queries :: Parameter Query To Get Field

Feb 7, 2014

I have a table which has 8 fields. The task is to design a query which always shows the first two fields (or any other two specific fields) and any one of the remaining 6 fields based on the input from the user. I am using a simple form with combo boxes to get the choices from the user.

View 11 Replies View Related

Queries :: Add Checkbox Parameter To Query

Dec 26, 2013

I am using the Multi Search from that's available in the template forum, and currently it's working perfectly. I am trying to add one checkbox (chkIncludeManifests) to the form to do some filtering.

When the box is checked, I should search all records. When the box is unchecked, I should search only records with no manifest number [manifestnum].

I've tried setting up an IIF statement to filter out the values that are empty but it's not working.

View 4 Replies View Related

Queries :: Cannot Open Query Which Has A Parameter

Jul 22, 2014

In Access 2003 I create a query which for one field was link to a value on a form.

Now I have to duplicate this form and instead to duplicate this query I wanted to use a parameter inside this query for one field and then via VBA call this query and give a value for this parameter.

My query name is: Query_Parameter

Fields inside: "Asset_Name" and "Isin"
Parameter is under the "Isin" field: [Look_Isin]

My VBA code is:

Sub Test_Call_ISIN()
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Set dbs = CurrentDb
'Get the parameter query

[Code] ....

When I run the code nothing happen ?

View 2 Replies View Related

Queries :: One Parameter Form For Several Query

Jul 9, 2014

I have always used parameter forms for inputing query/report criteria. However, they have always been for one query or report. However, all searches I have done for trying to use one form for several queries all I find is a simple response of "Create a form and then direct all the queries to grab the parameter from the form.". Sounds simple enough but I can never get it to work.

I have created a macro that runs 12 Append queries. I have also created a parameter form that has an unbound combo box. The combo box is fed by a query that gathers all the Data Dates for the user to select from. So if there are 24 different data dates then the combo box displays them all.

I tried creating a macro that first opens the form then opens the query, however, it runs the query before I can finish entering the criteria in the form. Then I just get a pop up of "You are about to append 0 records..."I have found several walk-throughs for having a query use a form to grab parameter, but have not been able to find one that shows you how to set up one form to run several queries.

I keep trying to find an answer, then give up and continue manually entering 12 dates for 12 queries when they pop up after running the macro. Now I need to create a macro that runs 24 queries and I don't want to have to go through 24 parameter pop-ups.

View 5 Replies View Related

Queries :: Passing Parameter To Select Query?

Jun 5, 2013

I have form with a button on it that launches a parameter-based Select query (which served as the source for a report). I didn't have any validation measure in place, so if the User supplied a bogus value, a blank report was generated. While not technically an error, it would seem more polished to generate a warning message if the User supplies a bad query value and prompt them to re-enter.

Having read other posts along these lines, I've added an unbound text box to the form which the User fills in first before clicking the button. When the button is clicked, it executes code that uses the DCount function to make sure the text box value is in the source table, and if it is then it runs the parameter-based Select query. My question is how to pass the value in the text box to the query as a parameter. Below is a sanitized version of the code that I've generated so far.

Private Sub SingleItemRptB_Click()
If DCount("[FieldName]", "[Table]", "[FieldName]=[TextBoxValue]") = 0 Then
MsgBox "Item not in database. Please check value and re-enter."
Else
DoCmd.OpenQuery "SingleItemQ", acViewNormal, acReadOnly
End If
End Sub

View 4 Replies View Related

Queries :: Passing (Is Not Null) As A Parameter In A Query?

Jun 16, 2015

I have a form which users can toggle whether they want to only see entries that has data in a certain field. Previously I have set up a separate query with a hardcoded 'Is Not Null' in the criteria, and set the form to call the different queries based on the status of a toggle button. This time there is 22 queries that need to be modified so I'm hoping there's a better way.

I have a hidden textbox on my form that has value "Is Not Null" or Null based on the position of the toggle button.

In my query for the field criteria I have [Forms]![MainForm].[txtCriteria] where txtCriteria is the textbox previously mentioned.

When I run the query no data is shown.

View 10 Replies View Related

Queries :: Date Range Parameter Query

Jan 8, 2015

I have a query that is hard coded with a date range.

SELECT tblCase.CaseId, tblCase.ReqReceived, tblCase.Letter_AMPI,
FROM tblCase
WHERE (((tblCase.Letter_AMPI) Between #4/1/2014# And #3/31/2015#)) OR (((tblCase.ReqReceived) Between #4/1/2014# And #3/31/2015#))
ORDER BY tblCase.CaseId;

I would like to create a parameter query that allows me to only enter the year and the query would append the rest of the date range. So for example, if I prompt the user to enter the date and they enter 2014, the query would know that it means Between #4/1/2014# And #3/31/2015# or if I enter 2015, it means Between #4/1/2015# And #3/31/2016#.As well the date would need to go into both fields ReqReceived and Letter_AMPI.

View 3 Replies View Related

Queries :: Dynamic Query Needs Parameter Two Times

Oct 18, 2013

Sometimes i have a problem with dynamical queries. For some of these i need to put in the same parameter value two times, before it works. Why this occurs?

View 2 Replies View Related

Queries :: Passing Textbox Value Into Sql Query Parameter

Apr 23, 2014

I'm having a very simple issue (I think) trying to pass a textbox value as parameter in a sql query.I have a multiline textbox and I use it to find several values in the database, so in this textbox all the values are pasted each per line and I have a small code to convert it to single line comma separated values.This is an example:The user enter the data:

[Text0]
A1C556CC3C-TNNN
C010070H13

The code convert this data to a single comma separated string and runs the query: ex: "A1C556CC3C-TNNN","C010070H13"

Code:
test = """" & Replace([Forms]![Search]![Text0], Chr(13) & Chr(10), """,""") & """"
[Forms]![Search]![Text0].Value = test
DoCmd.OpenQuery "FindPartNo", acViewNormal, acReadOnly

In the SQL code I use the IN operator to find the exact value for each record:

FindPartNo sql query:

Code:
SELECT Classifications.BU, Classifications.WisperPlantID, Classifications.PartNumber, Classifications.PartDesc, Classifications.US_CL_Code, Classifications.MX_CL_Code, Classifications.TARIC_CL_Code, Classifications.COEProject, Classifications.Supplier, Classifications.BrokerRequest, Classifications.CreatedBy
FROM Classifications
WHERE Classifications.PartNumber In ([Forms]![Search]![Text0]);

The problem here is, the query doesn't return results but if I modifiy the query and I put:

Code:
WHERE Classifications.PartNumber In ("A1C556CC3C-TNNN","C010070H13");

... the query returns the correct results.I'm passing the value incorrect into the sql code?

View 1 Replies View Related

Queries :: Using Parameter In Query With Calculation From Date

Apr 13, 2015

I have a database with a Date of Birth field. I have a query with a field that calculates the age from the Date of Birth (DateDiff("yyyy",[Date of Birth],Date())+Int(Format(Date(),"mmdd")

As a criteria in this field I want to be able to select a minimum age, so >=[please input minimum age]

However the results are bizarre - sometimes it gives the right answer, and sometimes not. It seems to have a particular problem with ages above 10, which show up all the time.

View 5 Replies View Related

Queries :: Get Output Of Query In A Parameter (VBA Variable)

Jul 1, 2015

How could i get output of a Query in a VBA variable ?? I'm trying as below butIi'm getting error:

Dim output As Integer
vari = DoCmd.OpenQuery("qryCompare", acViewNormal, acReadOnly)

Output of a query is a single MAX value.

View 4 Replies View Related

Queries :: Parameter Query To Search For Number

Feb 11, 2015

I have 2 tables: Table A contains [ID] (and other columns) AND Table B contains [Request ID] (and other columns).

However, [Request ID] contains several number separated by comma. For example: 10, 15, 20 etc.

I created a query with parameter with : Like "*" & [ID] & "*" under [Request ID] criteria.

Here is my problem:

if [Request ID] = 44, 60 then it is returning [ID] 4 records (4, 6, 44, & 60). Is there a way to show only 2 records? 44 & 60?

View 4 Replies View Related

Queries :: Parameter Query Prompt Twice In Forms

Aug 27, 2014

it also prompts twice when i try printing or try to save the current page as a pdf and also when i switch record? i think its a problem with the subform as it always is trying to fetch data. would there be a way to make it so that the subform and the form are linked so that the parameter query prompts once and the information stays there rather then having to prompt again when printing or saving as pdf?Two more things - on my total value box i wish to be able to always show 2 decimal places

The code already in place is :

Net : =Sum([TotalValue])
VAT: =Sum([TotalValue])*0.2
Gross: =[Text8]+[Text10]

(Net is Text8 and VAT is Text10)

i have already specified that the decimal place value is 2 instead of auto but it still doesnt work - if the number is a whole number i still wish to see .00 at the end of the field.One last thing - Would their be a way to carry over the information from my delivery note to my invoice note? which would save a lot of time retyping the parameter query.

View 6 Replies View Related

Queries :: Parameter In Query Decide By Click

Oct 23, 2013

how can run a query with paramtoeter of label, on which i click i want to run a query ,with parameter ,which decide by lebal, on which i click with in diffrent labels such as

i have 3 labels
1--A
2---B
3---C

when i click on label 1(A) query select record which belongs to (A) ,again when i click on label(B) this query show records which belongs to (B)

View 1 Replies View Related

Queries :: Parameter Query To Return Clients In Particular Age

Sep 10, 2013

I am using Access 2010. I've calculated the age of clients by creating a new field with Age: Year(Now())-Year([D O B]) but I cannot figure out how to use a parameter query to return the age of the clients between age 20 and 30, 30 and 40, 40 and 50 etc.

View 14 Replies View Related







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