Wrong Query Return

Feb 14, 2006

I placed ="G*" in a text field to get all names that begin with G and a blank return was issued. Maybe the manual I have has the wrong info. I have Access 2003 and a Access 2000 manual. Please help.

View Replies


ADVERTISEMENT

Function Return Wrong Value

May 24, 2005

Dear all
i have a problem that i don't know what to do with it?
Here it is:
i have a cost table in which FO cost is saved.This FO cost is used in different calculation, in different forms. so i create a function called get_FO_cost() as below.

Function get_FO_cost()
Dim s As String
Dim c, r As Object
Dim v As Single
Set c = Application.CurrentProject.Connection
Set r = CreateObject("ADODB.Recordset")
s = "select FO_Cost from Cost_table where month = '" & Me![month] & "'"
r.Open s, c, 1
If r.RecordCount <> 0 Then
v = r![FO_cost]
End If
r.Close
Set c = Nothing
get_FO_Cost = v
End Function

when I use this function for calculation then it returns wrong value.
for Example: the value in the table for FO_cost = 0.005 ( it has a datatype single in table)
then the value in form for this
25 * get_FO_Cost() = 0.124999997206032
but actually 25 * 0.005 = 0.125

when i debug the function code it shows FO_cost value 0.005, but when the debug is over the calculated value i.e. 25 * get_FO_Cost() is 0.124999997206032

Please help

View 3 Replies View Related

DSum Return Wrong Answer

Mar 1, 2014

i try to create a bank operations system, i have a table with this columns: nameBank, credit, duty, balance.i want to sum all credit and reduce from duty to get the balance like in bottom/i try with Dsum function like that:

Code:
Me.balance = Dsum([credit],"bankigOperations",Me.bankName = [bankName])-Dsum(....)

View 4 Replies View Related

Modules & VBA :: Return Rows In Query From Variant Array Return From UDF

Sep 16, 2014

I have a simple UDF that takes a string and returns a variant, which is an array of strings Example Input "Brick Wall" Return value would be a variant array with first element "Brick" and and second element "Wall" Now I have a table with a field of strings, and I want to make a query that returns all the results from the function, one per line.

So if my input table looks like this

[strField]
"kick the ball"
"return the pass"

my query result should looks like this

[Orig] [new]
"kick the ball" "kick"
"kick the ball" "the"
"kick the ball" "ball"
"return the pass" "return"
"return the pass" "the"
"return the pass" "pass"

Last time I had to do something like this I used VBA exclusively, with ADO objects, but I thought a query based solution would be easier.

With my current data the largest return array size my function returns is 27 elements but I wouldn't want to rely on that number being fixed.

View 3 Replies View Related

What Is Wrong With This Query?

Jan 15, 2007

SELECT s.weekth, s.contracttype, sum(case when s.[contract status]='advance complete' then price end)/sum([purchaing price])

from submissionandpd as s

THX

View 5 Replies View Related

What Wrong With This Query

Jan 22, 2007

t2 is a subset of t1, I want t1-t2.
but following code does not seem to work.


SELECT *
FROM t1
except
select *
from t2

How to fix this problem? Thanks.

View 1 Replies View Related

What Is Wrong With This Query?

Mar 14, 2007

SELECT Orders.DelAdd1 AS Street, Orders.DelAdd2 AS [Street 2], Orders.DelTown AS Town, Orders.DelCounty AS County, Orders.DelPostcode AS Postcode, Sandwich.SandwichName AS Sandwich, sum(Orderline.Quantity) AS Quantity
FROM Orders, Orderline, Sandwich
WHERE Orderline.Sandwichno=Orders.SandwichNo and Orders.DeliveryDate=[Please enter Today's Date]
GROUP BY Orders.DelPostcode;

It says I've not specified street as an aggregate function, but I don't want to!

View 1 Replies View Related

What Wrong With My Query

May 15, 2007

Hi Guys,

what could be the probelm with my query? Here:
******************
SELECT tblPartnerProfile.PartnerType AS [Org Type], tblPartnerProfile.PartnerName, tblPartnerProfile.PartnerLoc1, tblPartnerProfile.PartnerStatus AS Status, Count(PartnerType) AS TotalType,
FROM tblPartnerProfile
WHERE PartnerLoc1 = 1 OR PartnerLoc1 = 2
******************************
I would like to have it give a count of how many [Org Type] 1 and 2 for Loc1 1 and Loc2 2.

Thanks in advance,

Samia

View 4 Replies View Related

What Is Wrong With This Query

Jul 24, 2007

Hello,
I have a Query that I wrote as follows:

SELECT [TableA].[FieldA], [TableA].[FieldB], TableB.FieldC
FROM [TableA],TableB
RIGHT JOIN [TableA] ON [TableA].[FieldB] = TableB.[FieldD]
GROUP BY [TableA].[FieldA], [TableA].[FieldB], TableB.FieldC;

What happened was that TableA has Fields A and B, and Table B has a field C and D. Tables B and D have the same content (Not necessary unique) and I would like to see a mapping from Field A -> Field C by joining on Field B and D.

However, when I ran it, I got an "invalid arguement" error.

Could anyone help? Thanks a lot!


Regards,
Anyi

View 1 Replies View Related

Update Query Gone Wrong

Dec 7, 2005

please help, i have a form where i enter goods recieved vouchers,in this form if the cost price on the form is higher than the price in the Stock table then the price must be updated, if the price is lower then the price in the stock table doesnt need to be updated.
I have a method which i have used before with no errors:
i run an if statement on my Lost Focus() event procedure on TxtCostPrice
it looks like this:

Sub txtCostPrice_LostFocus ()
Dim Cost1 As String
Dim Cost2 As String
Cost1 = txtCostPerUnit
Cost2 = DLookup("price", "Stock Numbers")

If Cost1 < Cost2 Then

Dim DocName As String
DocName = "updateIfCostPrice"
DoCmd OpenQuery DocName, A_NORMAL, A_EDIT

MsgBox "Cost price has been updated"

ElseIf Cost1 > Cost2 Then
MsgBox "Cost price does not need to be updated"

End If

End Sub
this code links me to my update query, everything on my update query looks fine but when i run the code it doesnt seem to be updating.

Please help as my deadline is fast approaching at an arlaming speed!

View 5 Replies View Related

Wrong Data In Query

Jan 4, 2006

I am not sure how this query I made is pulling up wrong data. Everything else is fine, except for 1 row of data. It is supposed to pull how many demonstations were scheduled for that day and how many were executed. It comes up with 4 demos and 8 executed. That can't be right. I checked it with the actual data and there are 6 demos total and 4 executed. Anyone know what could be going on there? For the other 30 something records it works just fine.

SQL:
SELECT [Promo count].PromoNo, [Promo count].[# of Demos], Count(DemoOrder.Status) AS CountOfStatus, CountOfStatus/[# of Demos] AS Percentage
FROM [Promo count] INNER JOIN DemoOrder ON [Promo count].PromoNo = DemoOrder.PromoNo
WHERE (((DemoOrder.Status)="E"))
GROUP BY [Promo count].PromoNo, [Promo count].[# of Demos];

View 1 Replies View Related

Whats Wrong With This Query?

Aug 15, 2006

trying to create a table using a query, and I'm not sure whats wrong with this query:

CREATE TABLE FYIAdmin
(
FYI_ID COUNTER CONSTRAINT PRIMARY KEY,
FYI_Title varchar(100),
FYI_Text memo,
FYI_Date date
)

Sorry it its noobish :(

View 2 Replies View Related

Union Select Query (What Am I Doing Wrong)

May 28, 2006

Please see attached database

If you open the form called people you will see a command button
Called add charge once pressed will open a form called charge

On the Bill To combo Box I have the following Union Select Query

SELECT PrimaryInsurance, PersonID FROM tblpeople UNION Select SecondaryInsurance, PersonID FROM tblPeople

What I want the bill to combo box to display is only the Insurances that are related to the
Patient that the charge is for and not to display other patients insurances


Any Ideas

View 2 Replies View Related

Some Record Not Showing On Query.something Wrong?

Oct 27, 2007

I have make relational table on query, but some record not sohowing on query, although i have the record on table.

for example, i can't see the record with code :
131401.007
541000.00*

is the anything wrong?

thanks

View 3 Replies View Related

Query Returns WRONG FIELD!!!

Nov 9, 2007

This is at least the 3rd time I've come across something that is, to me, an extremely serious bug in Access. Anyone else seen this, and anything I can do to avoid it??
In a query, I ask for the values from Field A.
The query returns the values from Field B, but still calls it Field A.

This is in a fairly complex query. If I delete one particular field from the query, the bug disappears. If I put that field back, the bug returns.

Here is my current query:
SELECT ByPN_1.PartNumber, ByPN_1.LostPerSetup, ByPN_1.ActualMachine, ByPN_1.PermQty, ByPN_1.FirstOfFeederSize, ByPN_1.Leaf1, ByPN_1.FirstOfType, ByPN_1.NonPerm, IIf([nonperm]*[concurrentsetups]<1,1,CLng([nonperm]*[concurrentsetups])) AS QtyIfDed, [nonperm]*[setupsperday] AS MaxLoadsSavedPerDay, [qtyifded]*[setupsperday]/[concurrentsetups] AS DedLoadsSavedPerDay, IIf([maxloadssavedperday]<[dedloadssavedperday],[maxloadssavedperday],[dedloadssavedperday]) AS LoadsSavedPerDay, [loadssavedperday]*[laborrate]*[loadunloadperfeeder]*250/60 AS Labor_Annual, master_attr.STD_COST, [loadssavedperday]*[lostpersetup]*[std_cost]*250 AS Parts_Annual
FROM (ByPN_1 LEFT JOIN FeederCost1 ON (ByPN_1.ActualMachine = FeederCost1.Machine) AND (ByPN_1.FirstOfFeederSize = FeederCost1.Size) AND (ByPN_1.FirstOfType = FeederCost1.Type)) LEFT JOIN master_attr ON ByPN_1.PartNumber = master_attr.ITEM
WHERE (((ByPN_1.PartNumber)=107573));

HEre's the pertinent part of the record from BYPN_1:
PartNumberLostPerSetupFirstOfFeederSize
107573 3 12X4

But here's what the query returns:
PartNumberLostPerSetupFirstOfFeederSize
107573 12X4 12X4

Now, if I just delete the "parts_annual" field from the query:
SELECT ByPN_1.PartNumber, ByPN_1.LostPerSetup, ByPN_1.FirstOfFeederSize, ByPN_1.ActualMachine, ByPN_1.PermQty, ByPN_1.Leaf1, ByPN_1.FirstOfType, ByPN_1.NonPerm, IIf([nonperm]*[concurrentsetups]<1,1,CLng([nonperm]*[concurrentsetups])) AS QtyIfDed, [nonperm]*[setupsperday] AS MaxLoadsSavedPerDay, [qtyifded]*[setupsperday]/[concurrentsetups] AS DedLoadsSavedPerDay, IIf([maxloadssavedperday]<[dedloadssavedperday],[maxloadssavedperday],[dedloadssavedperday]) AS LoadsSavedPerDay, [loadssavedperday]*[laborrate]*[loadunloadperfeeder]*250/60 AS Labor_Annual, master_attr.STD_COST
FROM (ByPN_1 LEFT JOIN FeederCost1 ON (ByPN_1.ActualMachine = FeederCost1.Machine) AND (ByPN_1.FirstOfFeederSize = FeederCost1.Size) AND (ByPN_1.FirstOfType = FeederCost1.Type)) LEFT JOIN master_attr ON ByPN_1.PartNumber = master_attr.ITEM
WHERE (((ByPN_1.PartNumber)=107573));

Now the query returns what I expect:
PartNumberLostPerSetupFirstOfFeederSize
107573 3 12X4

View 14 Replies View Related

Queries :: Query Correct But Report Wrong?

Aug 3, 2015

Query 1: has all the data (description, account, amount).
Query 2: sums Amount by Account No.
Query 3: combines Query 1 and 2.

Query 3 also has a join by the Account No. There is a report based on query 3.

Issue: I can run query 3 to equal 0 and generate the report correctly but when I generate the query to not equal 0 the report brings in all the data.

View 4 Replies View Related

Queries :: Query Returning Wrong Results?

May 7, 2014

I have two tables Contacts & Allowance. There is a relationship defined between the two based on Contact ID (primary field/contacts - foreign key/allowance). The Contacts table has Firstname + Surname. I have produced a query based on certain fields in both tables however the result is totally pulling incorrect info.

View 11 Replies View Related

Queries :: Query Returns Wrong Values

Aug 30, 2014

My problems is that when I use below setup without the "Notes" tabel, they query works fine, and returns the amount of spares and time used by a single WBS ID. (Customer). But when I add another tabel and link it together. Its returns load of lines with the same data - it looks like its copying its self, over and over again.

View 4 Replies View Related

Access Giving Wrong Result Using Sql Query

May 10, 2012

I am using a MS access mdb file to display some record from oracle database using odbc connection.I have a table (linked table) called map_detail in mdb as well as oracle with same table structure.I formed one query in mdb (sql query) select * from map_detail where batch_no="SSO15121".It is always fetching some other result, but when I am changing the query by changing the batch no "SSO15148" it is working fine. I noticed that for cases it working.

View 3 Replies View Related

Query With Multiple Outer Joins Gives Wrong Result

Dec 15, 2007

Hello,

My query references 2 related tables: one for persons (PERS) and one for telephone/fax numbers and email addresses (CONT, for Contacts).
The relevant fields are:

PERS
pers_id (long) ---> primary key
pers_forename (text)
pers_surname (text)

CONT
cont_id (long) ---> primary key
pers_id (long) ---> foreign key
come_id (long) ---> foreign key
cont_number (text)

The foreign key come_id refers to a table for contact methods (COME), either "Phone (Home)", "Phone (Work)", "Mobile", "Fax" or "Email".

Now i want to list all persons with their home phone number and email address, also if they don't have one. It seems to be impossible to get it ...
I will explain what happens. Lets start simple: first list all persons with their home phone number (come_id = 1):
SELECT PERS.pers_forename, PERS.pers_surname, CONT.cont_number AS Phone
FROM PERS LEFT JOIN CONT ON PERS.pers_id = CONT.pers_id
WHERE (((IIf(IsNull([come_id]),1,[come_id]))=1));
This works fine. The IIf expression is necessary since we are dealing with an outer join: not all persons have a home phone number. If we would simply put "WHERE come_id = 1" then the query produces only the persons that have a home phone number.

But now i also want to see the email address (come_id = 5):
SELECT PERS.pers_forename, PERS.pers_surname,
CONT.cont_number AS Phone, CONT_1.cont_number AS Email
FROM CONT AS CONT_1 RIGHT JOIN
(PERS LEFT JOIN CONT ON PERS.pers_id = CONT.pers_id)
ON CONT_1.pers_id = PERS.pers_id
WHERE (((IIf(IsNull([cont].[come_id]),1,[cont].[come_id]))=1)
AND ((IIf(IsNull([cont_1].[come_id]),5,[cont_1].[come_id]))=5));
It seems perfectly logical: i added a second alias CONT_1 for the email address. Since this is also optional we have a second outer join, and the WHERE condition should also use an IIf expression.
The result is not correct though: the resulting recordset shows only the persons that have both a home phone number and an email addres or neither!
I have a lot of experience with SQL and queries, but i know i am not infallible. Nevertheless i am quite convinced that i should get all the persons: those that have a home phone number or an email address, or both or neither ...
I hope that someone of you can explain this.

View 3 Replies View Related

Modules & VBA :: Query Inserts Wrong Data In Table

Apr 30, 2015

I am writing the following query to insert data in tblpostroom from another table. Both the tables have same field names like Date1,582,1810.Now If I run the following query then in the fields 582,1810 of tblpostroom , the data gets stored 582,1810 respectively for all the records. But in actual fields 582 and 1810 store different data.

Code:
INSERT INTO tblpostroom ( Date1, 582, 1810 )
SELECT Date1, 582, 1810
FROM Sheet1;

View 5 Replies View Related

Trimming Query Return Value

Aug 25, 2005

HI, i have a field in a query called [cost_type], these typically contains the values "principle works" or "additional works" how can i set the query up so that it doesn't return the "works" part of the record? Could i just return the first 10 characters of the result?
thanks

View 1 Replies View Related

Need Query To Return Same Record Twice

Feb 23, 2006

Each record in my table has six possible sale dates as a result of cancellations. My problem results when a record is sold twice during the queried time frame (SaleDate1 and SaleDate2). Currently my query uses an if statement and if they are in the same time period, it will only return SaleDate1. I would like to see the record returned twice (once for SaleDate1 and once for SaleDate2). Any suggestions?

View 10 Replies View Related

Time Return Query

May 7, 2007

Hi Everyone,
I have a database that I enter time for in the form of military time, I would like to make a query to count the number of entrys in the PM,AM, And NIGHT. For instance if a record has a time of anywhere between 700 or 2299 I would like it to be in the AM catagory, then I would like to total up the number of AM records. Any help would be great. Thanks.

AM=700-1399 PM=1400-2299 NIGHT=2300-699

View 2 Replies View Related

Query To Return Table Name As A Value?

Jun 23, 2007

Hello all,

Is there a SQL function in Access that will allow it to return (as a field value) the name of the table where a particular record was found?

The reason that I want to do this is because I have a single table (Table A) with building address records counted and broken down by state and by month - but some of the records belong to smaller groups (e.g. Zone 1, Zone 2, etc.) that aren't states, but that I want to count in the crosstab as if they were. There are building addresses on Table A that belong to each of these four groups, so I need to somehow match the records on Table A with the appropriate Zone, and place the name of that Zone in the "State" column of the query results instead of the actual state so that I can then count the results in the same crosstab.

I had the intention of resolving this by creating three tables (with the listings of address information for each Zone #), then matching records in Table A to each Zone table in a query by the address field to get each record's appropriate Zone no.(if available), then using the results of this query in my crosstab - :confused: but I can't figure out how to get Access to create a calculated field that lists from which table a resulting query record came from, so I can't continue.:confused:

Any suggestions, if able, would be appreciated!

View 5 Replies View Related

Queries :: Max Query To Return One Row Only

Mar 20, 2013

I have a query which is a max sum of sales for several sales reps. (If that makes sense?)

Sales Rep, Total Sales
1, 100
2, 200
3, 500
4, 50
5, 150

I need to create a report which delivers the sales rep with the most sales and only that sales rep

e.g.

3,500

View 7 Replies View Related







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