Two Fields Using OR In Both Not Giving Me Results

Nov 13, 2007

:o Okay. I have a frustrating one. This is embarassing to me, because it seems so easy. Anyways, I have a form, where a person could select up to 3 different months and up to 3 different paper types. These combo boxes are listed in the criteria of those fields in my query. If I use the form and try to run my query, it gives me blank results. If I run the query and fill in the pop ups that show up asking for the information that the form is referring to, and I type in the same information, I get the results I expected. What am I missing here? Please help before I go bald!!!

View Replies


ADVERTISEMENT

Dcount Giving Wrong Results

Jun 14, 2006

Hi Folks,

I have answered my own question so I thought I would share as I couldn't find the solution in any posts. I confess that I don't understand why my results were wrong, but I managed to get them right. :rolleyes:

When using Dcount in a query, I was getting results which did not match the query results. For instance:

Phase_2: DCount("Project_Phase_ID","tbl_Prj_Details","Project_Phase_ID = 2")
gave an answer of 27 when there were in fact 41 projects in that phase.

Searching the forum I came accross this:

Count() always counts the entire domain.

So, Dcount is not counting the record set of my query but something else. I have 4 tables in the query and no idea what domain my dcount was looking at. I presume the various join types were messing with it somehow. :confused:

To get round this, I stripped out the Dcount expressions and changed the query to a make table. I then used the created table as the basis of a query in which I had my Dcounts. The dcount results now agree with the query recordset. :) :) :)

Any background on the bits I clearly don't understand will be gratefully received. I hope this helps someone else sometime.

Kind regards,

Keith.

View 3 Replies View Related

Query Giving Too Many Results (duplicates)

Mar 27, 2006

I have a query that selects from a table base on 3 entries (Name, BeginDate and EndDate) and should show me 12 other columns and their entries... I have 9 entries for a particular Name, but when i run the query i get 15 results. Some are duplicated but others are not and I don't know where to begin narrrowing it down. Any ideas where to start?

View 2 Replies View Related

Application Not Giving Desired Results

Jul 21, 2006

Hi There
we have a ms access application which pools data from AS400.
we have scheduled it for every week but there is a situation when its missing the data to feed the tables.
but when we run the queries manually it gives the desired results.
all kind of response are welcome
Best
danny

View 1 Replies View Related

SQL Query Giving Different Results In VBA/Access

Jul 11, 2007

Hi ,

I am using Access Application with Orcale Db as backend and this application is already in production.
The problem is.. USers Complained that the system is slow, this is because there is refresh (requery) for each Insert (When they click submit, that particular record is inserted and then a refresh has to be done to bring only unused member IDs on the User screen), i had used a Sql query using NOT IN , then i realized and now changed it to NOT EXISTS, but with this new query , if i test recordset. EOF , even though the query returns more than 13000 ..records, EOF sets to TRUE and the other part (not supposed to) gets executed. I really cant figure out why, i took the same query put it in query builder in Access and ran it , it gave 13000 records..but in VBA , this recordset is not giving expected results and so..i am totally confused..The part of the Code is shown below.

Code:newquery = " SELECT A.MEMBER_ID, A.MEMBER_NAME, A.ADDRESS_LINE1.................. FROM TABLE A WHERE NOT Exists ( SELECT '' FROM TABLE B where A.MEMBER_ID =B.MEMBER_ID)AND A.MATCH_LEVEL <> 0 ORDER BY A.MATCH_LEVEL DESC"rst1.Open newquery, Cnt, adOpenDynamic, adLockOptimisticIf rst1.EOF = False ThenForm_PHS_ASSIGN.RequeryForm_PHS_ASSIGN_SUB.RequeryElse MsgBox " No records to Process!" End If

EVEn though it should requery , it gives a message No records to process which is wrong. It works with NOT IN.... BUT VERY SLOW, NOT EXISTS IS FAST BUT DOES NOT GIVE ME WHAT I WANT..

Where am i going wrong..help pls!!!!

THANKS VERY MUCH!!

View 6 Replies View Related

DateDiff Function Giving Results With Numbers Way Too Large

Dec 28, 2007

I am finishing up a database that logs basic activities/tasks for my coworkers. As they go in to the database and log an activity in it stays open until they end their day or they start a new task. All this works fine, but the problem comes when I try to determine the total time spent (in hours) on each activity/task. I have written similar queries before and they worked just fine, but for some reason I am having trouble getting this one to work. Here is the expression I'm using...

Time Diff (in hrs): DateDiff("h",[Sample_TM_Table_1]![Time_In],[Sample_TM_Table_1]![Time_Out])

Unfortunately, say Time_In = 8:32:38 am and Time_Out = 8:33:03 am
The expression says that is equal to 946632.

For another Time_In = 8:33:00 am and Time_Out = 3:18:19 PM.
The expression says this equals 946639.

I have tried changing the format of the date/time in both Time_In and Time_Out fields to ensure they were the same and cross checked the expression but still get the same answers each time. Even when I try to use "n" for the interval or "s" it is still highly incorrect. The only thing that makes me think I still have a formatting issue is that the Time_In shows a long date on the results table while Time_Out shows it in a general date format. However, when I go into both the table and the queries to check the formatting they both show general date. Any ideas? I'm all out! Thanks in advance.

View 2 Replies View Related

Queries Codes For Giving Results As All If Criteri Is Left Blank

Sep 12, 2007

Hi

I have set up a form to run a query with the criteria linked to the options/drop down menus on the form. I am able to search for criteria set out in the combo boxes. However, what i would like to ensure is that if the drop down boxes are left blank the results will be to show 'all' results for that field.

help is greatly appreciated!

thanks in Advance!

Shapman

View 3 Replies View Related

Find And Replace Search Giving Either Ascending Or Descending Results

Dec 21, 2014

I have a DB and I have a button that triggers the find and replace. this will search over 100K entries and filter a specific client. The clients record can be 100's of entries.

This all works fine, but its always ascending and I have to scroll to the bottom for the latest record.

I can't set it to show Descending permanently as some employees can't cope with change. so...

I have a checkbox on my form for either Ascending or descending results. Is there any way I can get the find / replace to reference it, Or can I re-sort them after the search.

I've tried putting re-sort code on the 'find' button as lostfocus and mouseup but it doesn't work.

View 6 Replies View Related

Need Results For 2 Unmatching Fields!

May 27, 2005

Ok. I have a list of numbers in 2 fields. What do I do for the criteria to show the numbers that are not the same for each field. Ex:

693703<----
756756
733737<----
733781<----
664664

Both numbers are from 2 separate tables. How do I get teh query to only show the numbers that dont match?

View 1 Replies View Related

Join Two Fields In Select Statement Results

Apr 12, 2006

I'm sure this is easy to do, but I'm not sure how to word my search criteria when trying to look for a solution.


Let's say that I have 2 fields in MyTable: FirstName, LastName.

I've been trying to use the following query, but obviously it does not work:
Select (FirstName + ' ' + LastName) as MyName from MyTable.

I would like to have the following data returned to me in the following format:
John Doe
Jane Doe
Jim Doe
Jill Doe

Thanks,
CRhodus

View 1 Replies View Related

Queries :: All Results Not Shown Due To Empty Fields

Sep 9, 2013

I have a query which is supposed to search for all engines with a power rating between a user-specified range ('Rated Power'). The results should state all of these engines along with a few more related details ('System_ID_No', 'Project No', 'Rated Speed', 'Other Ratings' and 'Cylinder Capacity') that are useful to know. However, the problem arises when these other fields are empty. If empty, the related engine results do not appear in the final results spreadsheet. How do I make sure they are included aswell?

SQL:

SELECT tblProjectOverview.System_ID_No, tblProjectOverview.[Project No], tblProjectOverview.Customer, tblEnginePerformance.[Rated Power], tblEnginePerformance.[Rated Speed], tblEnginePerformance.[Other Ratings], tblEngineDefinition.[Cylinder Capacity]
FROM (tblProjectOverview INNER JOIN tblEnginePerformance ON tblProjectOverview.[System_ID_No] = tblEnginePerformance.[Sytem_ID_No]) INNER JOIN tblEngineDefinition ON tblProjectOverview.System_ID_No = tblEngineDefinition.System_ID_No
WHERE (((tblEnginePerformance.[Rated Power]) Between [Enter minimum power rating (kW):] And [Enter maximum power rating (kW):]));

View 10 Replies View Related

Autofill Fields Based On Results From Another Field In The Table?

Apr 18, 2007

I have an Access database with several tables and a multitude of subforms which are displayed on a single master form. The subforms are used to facilitate data entry. In several of the tables there are fields which are related and I would like to have some of these fields updated based on the results entered in the related field (i.e. the answer for one field depends on the other).
Field 1Field 2
[facing][DISC_CODE]
un3
up1
dn2

Field 1 is a simply a description of the basic dataset. This field is already set-up on form as a combo box that allows the user to choose one of three options. Field 2 is a code number used by another piece of software to identify a particular symbol. It is a new field being added to the database. There are 200 codes that identify a wide range of symbols for different types of data and I don’t want to have to look them up when I, or my assistants, are doing data entry.

My question is this; is there anyway to have the DISC_CODE value, Field 2, automatically entered in the table when the value for Field 1 is selected in the combo box on the form?

View 1 Replies View Related

Forms :: Search Fields On Form With Results In Subform

Mar 10, 2014

I want to enter text boxes on a form that are linked to certain fields on a table and when search criteria is typed in show the results in a table on a subform.

View 5 Replies View Related

Queries :: Excluding Records From Search Results That Have Fields With No Data?

Aug 6, 2015

I have a search form with 12 fields. In my query I use

Code:

Like "*" & [Forms]![CustomerRetestDatabaseSearch]![RetestLocation] & "*" Or Is Null

for each field on the search form.

I get the results I expect, it finds all records that match the criteria. Even if some of the fields in a record are null.

But if the query finds a record that matches one field I enter criteria into, and nulls for the other fields I enter criteria into it displays the record. I want to show exact matches. (If what I entered is null... don't show the record).

The reason I have "Or Is Null" is to include the records for the fields I left blank on the form.

Search Form with Criteria.PNG

Search Query.jpg

Search Results With Missing Entered Criteria(Dont Want These Records Included).jpg

View 2 Replies View Related

Tables :: Summation Of Fields In A Table Based On Query Results

Nov 5, 2013

I have a form that users can input data into and based on that data it runs a query and generates a report. These reports can be different based on user entered data on the form. My issue is within the report I would like to sum certain fields. The problem with trying to sum theses fields is that they show up on each row so I have hidden duplicates but when trying to sum the field it still trys to count the hidden duplicates thus giving a value that is of no use.

I have tried many methods to sum but one of the problems I continue to run into when I create a text box and build an equation and reference the field I would like to sum is when the report runs it is asking for a value to be entered for the field I am attempting to sum. I shouldn't need to enter a value as I am trying to obtain the value.

View 13 Replies View Related

LIKE Or CONTAINS Not Giving Me What I Need...Help!

May 24, 2005

Hello everyone,
Problem: I have an MS Access database in Frontpage that I'm using for my online site. Table is set up w/ a field named, "Artist" (amongst others). In this field I have artist's last name followed by a comma, a space, then the artist's first name. I am using the CONTAINS operator for my sql query statment. Everything works fine on the site if you search only by the first name, last name, or by typing in, exactly, the artist last name, comma, space, then the first name i.e. Presley, Elvis. However, if one were to type in "Elvis Presley", no records return. Why is this? I have also tried the LIKE operator and I get the same results. Here is the code where 45s is my table name and the others are just additional fields of which i have no problems:

SELECT * FROM 45s WHERE (Artist LIKE '%::Artist::%' OR Title LIKE '%::Title::%' OR Record_Label LIKE '%::Record_Label::%') ORDER BY Artist ASC

I'd appreciate any help as I've failed to get a solution from other forums and computer scientists that I've asked.

Thanks!
David

View 1 Replies View Related

Query Not Giving Me What I Need... Help

Nov 1, 2005

This query is getting complicated for me... I need help please! :(
I need it to give me the data for people between FirstMonth, Year and SecondMonth, Year...
Right now it's giving me only the FirstMonth, Year and SecondMonth, Year...
I think I need a between there somewhere but not sure where to put it...??
Hope this makes sense.
I'm doing the query in Access 2002

Thanks
Sarah




SELECT [FirstName] & ", " & [LastName] AS FullName, TriOct10.FirstName, TriOct10.LastName, TriOct10.Address, TriOct10.City, TriOct10.Prov, TriOct10.PostalCode, TriOct10.VolScreenCode, DatePart("m",[PRCDate]) AS Month2, DatePart("yyyy",[PRCDate])+3 AS PRCDueY2, TriOct10.PRCDate, TriOct10.MemberType, TriOct10.MemberStatus, TriOct10.ExpandName, TriOct10.RegOrgName, TriOct10.RegisteredRole
FROM TriOct10
WHERE (((DatePart("m",[PRCDate]))=[Enter 1st Month]) AND ((DatePart("yyyy",[PRCDate])+3)=[Enter First year])) OR (((DatePart("m",[PRCDate]))=[Enter Last Month]) AND ((DatePart("yyyy",[PRCDate])+3)=[Enter Last Year]) AND ((TriOct10.MemberType)="volunteer") AND ((TriOct10.MemberStatus)="Active" Or (TriOct10.MemberStatus)="probationary") AND ((TriOct10.ExpandName) Like "*" & [What Area?] & "*"))
ORDER BY DatePart("m",[PRCDate]), DatePart("yyyy",[PRCDate])+3;

View 2 Replies View Related

Using &lt;&gt; Giving Me Records It Should Not

Oct 22, 2007

I have a query that uses "<>" to find records that are not equal between 2 tables. The formula looks like this:

<> [tblWorkPerformed]![ID]

It works fine as long as there is only one record in tblWorkPerformed, but once I add a second record I get the records I dont want plus the records I do. The records I do what are there twice. I found how to only get single records of each, but it still desplays the records it should not. I tried a dummy database, and it does the same thing. Do I have something wrong or is this just not possible.

Thanks
Anthony

View 7 Replies View Related

Queries :: WHERE Statement - Enter Dates Into Date Reported Fields For Results To Show

Sep 11, 2013

I use this

'WHERE ((OperationalRiskEventTable.DateReported)>=Forms!U pdateForm!UDateBegin And (OperationalRiskEventTable.DateReported)<=Forms!Up dateForm!UDateEnd)'

in a query by form.

The problem is that you have to enter a date in the between values for results to show. If I don't enter information into a different field such as Full Name but I enter in 40 into Age then everyone that is 40 years old will show. On the other hand if I enter 40 into the Age field but I leave the Date Reported fields empty then no results will show.

How can I change it so that I don't have to enter dates into the date reported fields for results to show?

View 4 Replies View Related

Church Giving Database

Apr 25, 2007

I'm trying to construct a database to track church funds. I posted before and was given a link to a suitable schema but it was too comnplicated for me! Basically I need to track money given to a church through weekly transactions - money is given weekly through a numbered envelope. Each envelope has a number corresponding to the giver. I came up with this:

tb_parishioners
parishioner_id (PK), fname, lname, address etc
tb_FWO_Nos (FWO = free will offering)
FWO_ID (PK), fwo_Number
tb_contributions
Contributions_ID (PK), parishioner_ID (Both PK), week_no, amount, date

This doesn't really work. One giver can have only one FWO envelope but each envelope has many weeks/dates and I'm not sure how to link this. I want the form to have the week no and corresponding date already there so I just enter the amount. Then it has to be able to switch to a different year. Hope this is clear? Any suggestions?

Thanks.

View 1 Replies View Related

IIf Statement Giving Error

Nov 3, 2005

SELECT Conversion.[Asset Class], iif([asset class]<4000, "1", "2")
FROM Conversion;

View 2 Replies View Related

Sub Query Giving Me Grief....Please Help...! Tx

Apr 20, 2006

Hi all.

I have a sub query that was working until a couple of days ago when it decided to stop.

I have a Table called TblFieldValues which whenever a new value is entered into my relational Db.
Each new Value is given a ValueID and is Dated (full date/time stamp)

My Sub Query ensures that for each FieldID (ie if more than 1) it selects/shows the top most Date....But it is not grabbing all the fields for some reason???

Here is the SQL limiting criteria to a bare minimum (QuoteID)
SELECT Main.FieldID, Main.QuoteID, Main.QuoteTypeID, Main.SubSection, Main.FieldValue, Main.NumberFieldValue, Main.CalcFieldValue, Main.Date, Main.ValueID
FROM TblFieldValue AS Main
WHERE (((Main.QuoteID)=[Forms]![FrmQuote]![QuoteID]) AND ((Main.ValueID) In (SELECT TOP 1 Sub.ValueID FROM TblFieldValue AS Sub WHERE Sub.FieldID=Main.FieldID ORDER BY Sub.Date DESC)));

I had a thought it might be the way the info is put into TblFieldValues, as it is often put in via Code, in fact only when it is put via code is it not showing up as a rule.
So I had a look at the code that inserts it.

strSQL = "INSERT INTO TblFieldValue ([QuoteID], [QuoteTypeID], [SectionID], [FieldID], [FieldValue], [Date], [UpdatedBy]) Values ('" & strQuoteID & "', '" & strQuoteType & "', '" & strQuoteSection & "', '" & strFieldID & "', '" & strValue & "', '" & strDate & "', '" & strUser & "');"

'MsgBox strSQL

DoCmd.RunSQL strSQL

I had Now() in replace of strDate, but tried changing to strDate and diming strDate as Date and then setting strDate = Now() but doesn't really change it in the table.

I am certain it is in this somehow? Any ideas????
Your help will be greatly appreciated...

View 2 Replies View Related

Query Giving No Result

Mar 2, 2008

Hi all,

Would appreciate help on this. I have a query which combines the results of 3 queries. Once the underlying queries each has a result I get a result in my query, but if 1 of the underlying queries has no result I get nothing. (I hope this makes sense).

How can I set my query to show results even if the underlying query doesn't.

thanks in advance.

rgs
Ginny

View 5 Replies View Related

Instrrev Giving Error Data

Nov 3, 2005

Okay, I figured out that I can use the instrrev function to look at data from right to left.

I used this function:

Right([mydata], InStrRev(1, [Mydata], "-"))

in a query in an attempt to get all data right of the "-".

When I run my query, I get "error" instead of the data I was expecting.

What is wrong with the function? BTW i am using Access 2002.

TX
Al

View 4 Replies View Related

Sum Total Giving Interesting Result?

Oct 10, 2007

Ok baisically im doing a quick db for my company that is organising every file stored within the server and monitoring their last access'd, modified etc... I have a query which collates all the files which can be deleted on a server and file count is something alond the lines of 300K+ however i have also Sum'd the file sizes and instead of giving me some mental file size it has given me this result: 1.29659732507E+11

I mean i am no mathematician.. cant even spell it :S anyways im guessing that the number: 1.29659732507E+11 is actually 1.29659732507 to the power of 11?

Is there anyway i can get access to show the actual number i dnt care how long it is i just want a reliable, definitive result i can show my boss!

Cheers

View 1 Replies View Related

Concatenate Not Giving Needed Result

Nov 29, 2007

After searching through 18 pages of search results I have not found the answer. Would someone please tell me why this expression is not working in my query?

RCStatement: """&[RootCauseStatement]&"""

The result is "&[RootCauseStatement]&"

View 4 Replies View Related







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