Join In Query Not Working Properly?

Jan 15, 2006

I have a query where I'm selecting fields from two tables - Students and Attendance. I have selected option 2 in my Join Properties, i.e "Include ALL records from Students and only those from Attendance where the joined fields are equal". The tables are joined by StudentID. Either I'm misinterpreting what the join is supposed to be doing or it's not working.
I need to see every record in Students regardless of whether or not they have a record in Attendance. I need to calculate absences and tardies. If there's a matching record in Attendance, I subtract the date absent from the total days. If there's no matching record in Attendance, I still need to calculate total days and show it. As it is now, if there's no matching record in Attendance, it doesn't do anything. How can I get it to do what the join says, "Show ALL records in Students as well as those that match in Attendance?

Thanks

View Replies


ADVERTISEMENT

DSum Not Working Properly

Dec 8, 2006

I can't figure out what I have wrong in my code. I've searched all over the forums and the help files in Access. I'm sure it's something simple. Could someone please take a look?

=DSum([DefectQty],"d_sub1_DefectReport","CodeID= "" & [tblDefectCodes].[CodeID] & "" AND ""[InspectDate] >= #" & [Forms]![frmDefectDetailReport]![txtStartDate] & "#" And "[InspectDate] <= #" & [Forms]![frmDefectDetailReport]![txtEndDate] & "#")


I'm trying to get a sum of all defect quantities between a date range from a user form. Rather than summing all the defect quantities for a defect code, it's summing up the total quantites for each quantity. I'm sure that doesn't make sense so here's an example:

InspectDate CodeID DefectQty DSum Should Be
6/1/06 100 1 3 5
6/2/06 100 2 4 5
6/3/06 105 1 3 1
6/4/06 103 1 3 1
6/5/06 100 2 4 5


The domain is a query because the dates come from a different table than the defect quantities, so the query is pulling all the relevant data to be summed.

View 6 Replies View Related

Count Not Working Properly

Nov 20, 2007

Dear Access Mates:

Code:

=NZ(DCount("[DEGREE]","JUNE2005ALL","[DEGREE]='MSED' AND 'MS' AND [DEPARTMENT]='EDUCATION' "),0)

This statement is in an unbound text box but it does not return the proper total. It is counting only the "MSED's" and not "MS's".

This information is from a table.

Is the above syntax correct?

Many thanks to all.

Regards,

Dee

View 3 Replies View Related

Code Not Working Properly..urgent Pls.

Apr 17, 2006

Hi All,

I have Header form and subform subform in it with following fields

Subform fields are :

1. MQE_No : (Text field as it will be like MG-120, MG230), Duplicate OK)
2. RPO_No : (Number field – Double, Duplicate OK ) The are project no.
3. ForemanNo (Number field – Long Int – Duplicate OK)

Header form fields are ;

1.ForemanNo – Long Int – No Duplicate
2.Other fields…

The subform field have ForemanNo One-To-many relationship with Header form.

Following project MG-411 need to enter (assign) to foreman no. 641

Actual data to store in subform

MG-411 (MQE_NO)
5421654 (RPO_NO)
641 (FOREMANNO)

I started to enter data into subform selecting the ForemanNo at header so records to enter in specific foremans account. Everything is fine here.

What I need is:

I would like to select / add another Foreman into the header and start entering same above data for another Foreman. Bcz sometimes we need to do like this in case previous Foreman may go on to a week vacation. We can not stop project for a week. So need to assign project to other foreman.

When selected the Project (MG-411) thru a combo to assign it with other foreman, it should give a short msg to user that this project has already been assigned to “XYZ” forman. Need to assign again “ (Y/N box )

If Y then data entered otherwise cancelled.

To achieve this, I did the following but only 50% success. (Used Cmbo CboRPO2 select MQE_NO). Tried to satisfy both condition but no use.

Private Sub CboRPO_AfterUpdate()
If DCount("*", "T_RPO_Footer", "RPO_No = " & RPO_No) > 0 And DCount("*", "T_RPO_Footer", "ENO = " & ENO) Then
MsgBox "RPO ALREADY ASSIGNED TO SOMEONE / FOREMAN", vbOKCancel, "WARNING!!!"
Me.Undo
Exit Sub
Else

Dim Msg, STYLE, TITLE, HELP, CTXT, Response, MYSTRING
If DCount("*", "T_RPO_Footer", "RPO_No = " & RPO_No) > 0 And DCount("*", "T_RPO_Footer", "ENO <> " & ENO) Then
Msg = "RPO ALREADY EXIST WITH OTHERFOREMAN, ASSIGN AGAIN TO ANOTHER ?"
STYLE = vbYesNo + vbInformation + vbDefaultButton2
TITLE = "!! ATTENTION !!"
HELP = "TEST FILE"
CTXT = 1000
Response = MsgBox(Msg, STYLE, TITLE, HELP, CTXT)

If Response = vbYes Then

Me.MQE_NO = Me.CboRPO.Column(0)
Me.RPO_No = Me.CboRPO.Column(1)
Me.WORKSHEET_NO = Me.CboRPO.Column(2)
Me.WORKORDER_NO = Me.CboRPO.Column(3)
Me.WORK_DESC = Me.CboRPO.Column(4)
Me.PL = Me.CboRPO.Column(5)
Me.PipeLineKM = Me.CboRPO.Column(6)
Me.DiaMeter = Me.CboRPO.Column(7)
Me.PipeLength = Me.CboRPO.Column(8)
Me.PipeLineArea = Me.CboRPO.Column(9)
Me.P = Me.CboRPO.Column(10)
Me.RPO_AMOUNT = Me.CboRPO.Column(12)
Me.INV_AMOUNT = Me.CboRPO.Column(13)
Me.Status = "WIP"
Me.StatusID = 2
Me.CboStatus.SetFocus
Else
Me.Undo
Exit Sub
End If

Else
Me.MQE_NO = Me.CboRPO.Column(0)
Me.RPO_No = Me.CboRPO.Column(1)
Me.WORKSHEET_NO = Me.CboRPO.Column(2)
Me.WORKORDER_NO = Me.CboRPO.Column(3)
Me.WORK_DESC = Me.CboRPO.Column(4)
Me.PL = Me.CboRPO.Column(5)
Me.PipeLineKM = Me.CboRPO.Column(6)
Me.DiaMeter = Me.CboRPO.Column(7)
Me.PipeLength = Me.CboRPO.Column(8)
Me.PipeLineArea = Me.CboRPO.Column(9)
Me.P = Me.CboRPO.Column(10)
Me.RPO_AMOUNT = Me.CboRPO.Column(12)
Me.INV_AMOUNT = Me.CboRPO.Column(13)
Me.Status = "WIP"
Me.StatusID = 2
Me.CboStatus.SetFocus
End If
End If
End Sub


I tried with following code also

'Dim cdn As String
'cdn = "[MQE_NO] = '" & Nz(CboRPO, "") & "'"
'cdn = cdn & " And ENO = " & ENO

'If DCount("*", "T_RPO_Footer", cdn) > 0 Then
'MsgBox "THIS RPO ALREADY ASSIGNED TO THIS FOREMAN", vbOKOnly, "WARNING!!!"
'Me.Undo
'Exit Sub
'Else
‘do something
‘End if

Can somebody help it please.

With kind regards,
Ashfaque

View 1 Replies View Related

Import Feature Not Working Properly...

Sep 12, 2005

Hey all, I have a strange problem that I can't seem to find the solution for...

At my work we have a number of computers running W2k with Office 97.
We daily have to import excel spreadsheets into Access.

This is never usually a problem as obviously as soon as you click import the import spreadsheet wizard appears.

But on one particular machine it doesn't.

Basically on this computer Access will import the excel file, but won't bring up the wizard that lets you say what to import, whether the first row contains a header, the data type for each field etc, it just asks you to select what sheet you want, then imports it, no options.

Now the ironic thing is that usually this is not a problem as the file is still imported without any problems, but the other day we had a file that once imported was all messed up, all fields all over the place.

When done again on a different computer there were no problems so I'm assuming that this peculiar way of importing is to blame for messing up the data.

Does anyone know how I can resolve this? I have tried dragging the accwiz.dll over the regsvr32.exe and it says it's registered successfully, and I have checked that it is the correct version number, what am I missing?

It would make more sense if it just didn't import, then you could better understand how to fix it, but it's the fact that it does import, just not in the 'usual' way that bothers me. How can I make it bring up the proper import spreadsheet wizard?

Kind Regards
rd_boon

View 1 Replies View Related

Filter By Form Not Working Properly

Feb 13, 2007

Hi,

I'm working in Access 97 and I've got a form that I want to use to create filters with.

There are a couple of things that I'm not clear about and I'd appreciate any suggestions that you can make:

1. The form seems to remember the last filter, so when I click on the Filter by form button it shows the last filter by default. I've included the following in the click event:
RunCommand (acCmdRemoveFilterSort)
Me.FilterOn = False
RunCommand (acCmdFilterByForm)
Surely either of the first two statements should remove the filter, shouldn't they? and if not then what are they for?

2. I can't get the 'OR' tabs to show at the bottom of the filter by form screen unless I apply the filter once and then click on the filter by form button again. Is there any way of forcing these tabs to appear?

Thanks for any help/advice you can offer.

Regards,
Bernard D

View 2 Replies View Related

The Count Function Not Working Properly.

Oct 6, 2005

I am using the “count function” on an MS Access 2003 Form field. The count function seems to be working fine except it is not placing the result into the table field.

Does anybody know what I am doing wrong?

Can someone show me the proper format for using the count function used on a form field, where the result is to be placed in a table field?

Please Help!!!



Seti UNIVERSE
http://www.setiuniverse.com/
All of the SETI (The SEARCH for EXTRA--TERRESTRIAL INTELLIGENCE) disciplines in one place.
(Radio, Optical, Microwave, and Amateur SETI)
Stop by Seti UNIVERSE and find out, what you didn't know about SETI.

View 1 Replies View Related

Tick Box And Text Box Not Working Properly

Aug 7, 2006

I have a 'yes' check box and a 'no' check box. When the 'yes' check box is ticked, it enables a text box so I can enter a date and disables the 'no' box. Great, how it should work.

However, for some reason, whenever a date is entered into the text box when the 'yes' box is checked, every 'no' box afterwards is greyed/disabled out.

The thing is, it doesn't happen when no data is entered into the text box, when the 'yes' box is checked. So I can have the yes box checked, the no box will grey out as it should, and the text box will be enabled, as it should. But as soon as I enter a date, the above problem happens.

If that's not too confusion, can anyone help?

I've tried attached the database, but apparently it's too big, so i've posted the code underneath.

Cheers

Dan

EDIT: - i've just figured out that this problem is solved when I close the form and re-open it. But obviously I don't want to keep doing this every time I have to enter a date in a record.

Code:Private Sub chkSuccessful_AfterUpdate()If chkSuccessful = True ThentxtDateAppointed.Enabled = TrueEnd IfIf chkSuccessful = True ThenchkSuccessfulNo.Enabled = FalseEnd IfIf chkSuccessful = False ThenchkSuccessfulNo.Enabled = TruetxtDateAppointed = FalseEnd IfEnd SubPrivate Sub chkSuccessful_Enter()If chkSuccessful = True ThentxtDateAppointed.Enabled = TrueEnd IfIf chkSuccessful = True ThenchkSuccessfulNo.Enabled = FalseEnd IfIf chkSuccessful = False ThenchkSuccessfulNo.Enabled = TruetxtDateAppointed = FalseEnd IfEnd SubPrivate Sub chkSuccessfulNo_AfterUpdate()If chkSuccessfulNo = True ThentxtDateAppointed.Enabled = FalseEnd IfIf chkSuccessfulNo = True ThenchkSuccessful.Enabled = FalseEnd IfIf chkSuccessfulNo = False ThenchkSuccessful.Enabled = TrueEnd IfEnd SubPrivate Sub chkSuccessfulNo_Enter()If chkSuccessfulNo = True ThentxtDateAppointed.Enabled = FalseEnd IfIf chkSuccessfulNo = True ThenchkSuccessful.Enabled = FalseEnd IfIf chkSuccessfulNo = False ThenchkSuccessful.Enabled = TrueEnd IfEnd Sub

View 1 Replies View Related

Self-join Not 100% Working - Please Help

Feb 11, 2006

I'm trying to create a database of Publications (instruction manuals) where one publication is a modification to a parent modification. I'm storing all 'publications' in one table for better maintenance. This means that I have to use a Self-Join if I want to make one the parent, and one the child. Fundamentally this is no different than the Employee/Supervisor example I've found in many places:

http://www.databasedev.co.uk/self-join_query.html

I created a query with two copies of the same table with the 2nd one renamed for easier viewing. The query final comes up, but when I choose "ParentPub", it doesn't give me a drop down showing the other pubs so that I can choose one to be the parent.

What did I do wrong? I should be able to open up the table 'tblPubs', and get a drop down menu showing me all the pubs I can assign as a parent.

Thank you for your help,
Enrique

View 3 Replies View Related

Forms :: Form Working Properly Alone / But Gives Error When Combined With Other Forms

Jun 5, 2015

I have a form "NewMetalF" that has three combo boxes. The first one is used to choose "Precious Metal" or "Base Metal". The second one shows all the metals based on the first combo box. When I open the form in form view alone the combo boxes work flawlessly. I run the form "NewMetalF" within another form "NewExternalPartF" by clicking a button "AddMetal". When the button is clicked "NewMetalF" opens. The first combo box is selected, and when the second combo box is clicked the error "Enter Paramater Value" "Forms!NewMetalF!cboPreciousOrBase".

View 13 Replies View Related

Query Not Displaying Properly In Report

Apr 25, 2006

I run a Query based on some data in a "drop-down" box. It works in just datasheet view, but when I print it on a report, it displays the position that the data is in the drop-down box.
How do I display the data, not the position on the report? Here's an example:
My drop down box contains:
apples
oranges
bananas

My query returns apples, but in the report view it displays the number "1" instead of my data "apples". If the query returned oranges, the report would display "2" instead of "oranges" and so on.

Any ideas?
Jen

View 5 Replies View Related

Query Won't Filter For Dates Properly?

Aug 20, 2007

I have a query which is filtering by date as criteria...but it won't filter right.There is a date field from a table in another query which has date/times in it.I have used Format([Field], "Short Date") in that query to display just the date.I am now doing another query which points to that query (It's a SQL Union query if that matters) and it has the following for the Criteria:Between "6/1/2007" And "6/30/2007"However, it is showing anything in the month of June for the years 2005, 2006 and 2007, instead of just 2007. Any ideas why it is doing this? It doesn't make sense to me that it will filter for the month/date but not the year.I also tried changing the format to Format([Field], "mm/dd/yyyy") and criteria of "06/01/2007", etc.

View 11 Replies View Related

Queries :: How To Properly Use IsError In Query

Mar 13, 2015

I want this query to count all of the different types of order (Clase de Orden) and if a type of order isn't found, to return zero. How do I do this using IsError, since when it doesn't find an order, it gives me an error. This is the query:

TRANSFORM Count([E 025].Porcin) AS CountOfPorcin
SELECT[Listado de Empleados].Supervisor, [E 025].[Alias de TP], [E 025].Usuario, Telfonos.Telefono, Count([E 025].Porcin) AS [Total Of Porcin]
FROM Telfonos INNER JOIN ([Listado de Empleados] INNER JOIN [E 025] ON[Listado de Empleados].[Codigo de Usuario] = [E 025].Usuario) ON

[code]....

View 1 Replies View Related

Queries :: UNION Query Will Not Execute Properly

Apr 1, 2015

UNION Query will not execute properly. Remove "WHERE" statement query runs.The WHERE statement is used to locate all duplicate records, based on serial number, in a table. Also, it excludes certain data contained in two of the four tables. There are four separate queries for four separate tables. They all work until incorporated into a UNION QUERY.

Question, is there another way to structure the "WHERE" statement for this UNION Query and achieve the same results?

View 6 Replies View Related

Multiple Query Results Not Populating Report Properly

Sep 29, 2011

I currently have a combo box (combo121) on a form. I select the "Company" which is connected to "Company" in the query via [Forms]![courseinfo].[combo121]..That is working. When I press the "query" button on the form the selected company in the combo box is updated in the query and it updates the report templates.I also want to use the same system to populate a different report, using the same query. This works a bit differently.

Once the company is selected in the first combo box(combo121). I have other combo boxes which bring up students attached to that company. I have multiple combo boxes because I need select multiple students for the one report. These students are in fields "First Name" and "Last Name". So in the query I can only have those fields once. I have several links to the several combo boxes under "Last Name" as that is the "bound" selection for the combo box:

[Forms]![courseinfo].[comboname1]
[Forms]![courseinfo].[comboname2]
[Forms]![courseinfo].[comboname3]

Problem I am finding is this is bringing up several lines in the query. So when I try to populate the report with all of the different Students I have selected for the query, it won't work properly because I can only put "First Name" & 'Last Name" fields on the report once.

View 4 Replies View Related

WHERE Clause On LEFT JOIN : Why Do I Get Join Expression Not Supported Message?

Nov 10, 2006

I've been toiling with the issue of WHERE clauses on the "Right" side of Left Joins. I'm aware that you need to use JOIN ON......AND.... rather than JOIN ON....WHERE.... if the WHERE relates to the Right Hand table.

I've even got an example in my DB where the above works, but now am struggling to use the same theory for other tables. Therefore, I went and created two Mickey Mouse tables to test the logic but am getting an error.

I have
Table 1 with one field called Field 1 - values A, B, C
Table 2 as follows

Field 1.....Field 2.......Field 3
A.............100
C.............200..........XXX

I hoped to have a query that finds all records on Table 1 and records on Table 2 where Field 1 matches on the two tables and Field3 = XXX

My SQL is
SELECT Table1.Field1, Table2.Field1, Table2.Field2, Table2.Field3
FROM Table1 INNER JOIN Table2 ON Table1.Field1 = Table2.Field1
AND Table2.Field3="XXX";

but I get Join Expression not supported

What am I doing wrong?

Thanks
Andrew

View 7 Replies View Related

Create A JOIN Of Different Tables Called Join A Variable And List

Nov 16, 2013

And then called this join as a symbol or variable, and then have it use to select the items from these joined tables, can this be done in Access? Here is an example of a code that I created, but it has an error message saying the FROM syntax is incorrect.

Code:
SELECT firstJOIN.trainID, firstJOIN.trainName, firstJOIN.stationID, firstJOIN.stationName, firstJOIN.distance_miles, firstJOIN.time_mins
FROM (trains INNER JOIN ((station INNER JOIN lineStation ON station.stationID = lineStation.stationID)
INNER JOIN bookingLeg ON bookingLeg.startID = station.stationID or bookingLeg.endID = station.stationID )
ON trains.trainID = bookingLeg.tid) as firstJOIN

Can Access do something similar to this, in the FROM statement I joined 4 tables, because each unique fields are in each table and I have to joined them to get those fields. I called this join firstJOIN and in the SELECT statement, I list those columns in the table by calling it firstJOIN.trainID. Can Access do something like this, but syntax it differently?

View 6 Replies View Related

Queries :: Join Results Of Unmatched Query With Matched Query To Include Null

Mar 24, 2013

I am trying to do the good 'ol sales report (query) to include customers with no sales.

I have a customers table, account number table, sales table & sales (line) detail table. (all linked in that order)

If I run a query to show customers (in the customer table) with account numbers, that works

An unmatched query to show customer without an account number works (but of course the unmatched account number field isn't shown).

How can I get the two two be shown together with the "unmatched" having a null or 0 for their account number?

I am guessing in principle, the resulting solution can be modified to show customers without sales alongside those with sales?

View 3 Replies View Related

Join Query

Jun 6, 2005

Hi All,

I have 2 tables. [1] AvailableCars [2] CarPics

[1] AvailableCars consists of fields as Zone (eg. ZoneA, ZoneB, ZoneC) , CarCategory (eg. CarAA1, CarAB1, CarAA2 ... and so on), DailyRates, and Valid DateBounds (FromDate, ToDate).

[2] CarPics consists of CarCategory and Carpicture (Path of the car image).

Now I want to Bring Only those cars from the AvailableCars table and CarPics which satisfy the criteria of falling between Valid Date Bounds...I am using join as the following :

SELECT
AVAILABLECARS.ZONE, AVAILABLECARS.CARCATEGORY, AVAILABLECARS.DAILYRATES, AVAILABLECARS.FROMDATE, AVAILABLECARS.TODATE, CARPICS.CARPICTURE
FROM CARPICS
JOIN AVAILABLECARS.CARCATEGORY = CARPICS.CARCATEGORY
WHERE
AVAILABLECARS.ZONECODE = "ZONEA2XY" AND
AVAILABLECARS.FROMDATE BETWEEN "DATEVAR1" AND "DATEVAR2"
ORDERBY AVAILABLECARS.ZONE, AVAILABLECARS.CARCATEGORY

Using above query, I am not able to get the desired results. :o

Can Any body help me in solving this problem ? :confused:

Thanks in Advance,

Regards,

Jigs

View 3 Replies View Related

Query With Join And Where

Jul 14, 2005

I need to write a query which retrieves all the records from first table and those matching from second table and also satisfies a criteria.

I had

Table 1
F1
F2
F3

Table 2
F4
F5
F6
F7

I had to get all the records from Table1 and also those matching with Table2
So i did left join and getting all the records.
And I also need to check whether F3 in Table1 is in between F6 and F7 of Table2.

So I wrote query like this

SELECT Table1.F1, Table1.F2, Table2.F5
FROM Table1 LEFT JOIN Table2 ON (Table1.F1 = Table2.F4) WHERE Table1.F3 BETWEEN Table2.F6 AND Table2.F7;

I am getting only those records which are matching where condition.
I need to get all the records including which match the criteria and also those which don't match.

Please any suggestions?

Thanks

View 3 Replies View Related

Query With Inner Join

Nov 30, 2005

I am trying to create a query which shows only the newest note for every prospect. I have the code below, but I get a 'Syntax error in JOIN Operation' when I try to run the query and TBLNotes is highlighted.


SELECT TBLProspect.CompanyName,TBLNotes.Note, TBLNotes.NoteDate
FROM TBLNotes AS a
INNER JOIN TBLProspect ON TBLProspect.LeadID=TBLNotes.LeadID
WHERE ((((Select Count(*) from tblNotes where LeadID=a.LeadID and NoteDate>=a.NoteDate)) In (1)))
ORDER BY a.LeadID, a.NoteDate DESC;

Where am I going wrong?

View 1 Replies View Related

Inner Join Or Sub Query?

May 7, 2006

I hope someone out there can help me, I'm not an SQL experianced person, I only know enough to make problems. Anyway I believe my problem below is probably simple to someone that knows SQL very good. I have a link to a sample Access database if anyone is interested in helping me solve this.

The Sample Database (http://shadesoffire.net/files/db1.mdb)

Have a problem and can't quite seem to get it solved. I have simplified the whole thing to make it easier to understand.

I want a report that shows me the Product Category and Sum from work orders that were > $100.

I'm not quite sure how to do this, I've tried several methods of Joining and Sub queries but nothing really works. All I get in my results is product categories > 100. See I would expect the product category to be on the report even it it were $55 if it came from a work order containing total costs > 100.

I have manually supplied the results that I want, any help would be greatly appreciated. My real problem deals with larger results and numbers but these are the basics.

Linked is an Access database with one of my queries that show all work orders > 100. I would expect all those product categories in my summary report.

Redesign of the database is not an option.

These work orders are all > 100, the total on all reports should be $511


WorkOrderNo Total Cost
00001 $120.00
00003 $268.00
00005 $123.00



These product categories are associated with the above work orders and this is the result I am looking for.


Prod Cat Costs
12 $176
19 $89
22 $233
91 $13


The above results would come from this:


WorkOrderNo LineNo PartNo Cost Cat
00001 1 ABC $55.00 22
00001 2 XYZ $65.00 12
00003 1 ABC $89.00 22
00003 2 XYZ $77.00 12
00003 3 123 $89.00 19
00003 4 456 $13.00 91
00005 1 ABC $89.00 22
00005 2 XYZ $34.00 12

View 2 Replies View Related

Help With SQL Join Query

Jan 3, 2007

Hi all, this is my first post to the board. I’ve been searching through the forums but haven’t been able to put all the pieces together on my problem. First some background on my application:
I have 3 tables ISSUES, UPDATES, and PRTS. Each record in ISSUES has several records in UPDATES, and may have a single record in PRTS. The issues and updates tables have 3 “clones” (everything except the table name prefix is the same) that are used by other departments. All of the clones use the same PRTS table.
I am trying to put a query into SQL (I first built it using the query builder & an example from Microsoft for a query to find the last record) that will return each issue, along with the last update associated with the issue. My intent is to switch the table names using code depending on the user’s selection. I know how to switch “ElectricISSUES” to “PowerISSUES” below, but I do not know how to switch the source for the “qryLastUpdate”. Any help would be greatly appreciated.

issueSQL = "SELECT ElectricISSUES.Index, ElectricISSUES.Status, ElectricISSUES.Description, ElectricISSUES.Driver, ElectricISSUES.Champion, ElectricISSUES.PRTS, ElectricISSUES.SubDate, ElectricISSUES.DateClosed, ElectricISSUES.Diamond, Date()-[Subdate] AS DaysOld, qryLastUpdate.Update, qryLastUpdate.Udate, qryPRTS.Step, qryPRTS.[Next Step], qryPRTS.Designee, qryPRTS.[Ewo#], qryPRTS.BreakPointDate " & _
"FROM (qryLastUpdate RIGHT JOIN ElectricISSUES ON qryLastUpdate.UIndex = ElectricISSUES.Index) LEFT JOIN qryPRTS ON ElectricISSUES.PRTS = qryPRTS.[Prob#] " & _
"WHERE (((ElectricISSUES.Status) = 'closed')) ORDER BY ElectricISSUES.Index;"
db.OpenRecordset (issueSQL)

View 8 Replies View Related

Query Without Join??

Jan 30, 2007

I really don't know how to describe this, so bear with me!

i have a table of sales data 'tSales' that holds 3 years of transactions.

Fields are

Acc
Cust
Market
Prod
Qty
Value
Cost
Material
Labour

I have another table 'tLabRate' that holds our labour rates

e.g. in 2004 £20ph, 2005 £25ph etc

in the Form:

RateID
LabRate 20.00 25.00
LabFactor 0.6666 0.8333
LrFrmDate 01/01/2004 01/01/2005
LrToDate 31/12/2004 31/12/2005 etc

What i am trying to do is display the correct factor for the point in time, e.g.
LabFactor where sDate > than LrFrmDate AND < LrToDate

How do i do this in a query?? i can't join i don't think becasue there isn't a common field....?

Thanks

Graham

View 4 Replies View Related

Join Query

Mar 31, 2007

Hi all
How are you?
I have a small question....
I have a db with 2 tables (Contacts, Products).
Contacts table has 6 columns (CustomerID, CustomerName, Bread, Tea, CD, Pencil)
Products table has 2 columns (ProductID, ProductName).
I want a query that show this result:
Customer NameProduct Name
JohnTea
JohnCD
MarkBread
MarkCD
MarkPencil
JaneTea
TonyBread
TonyPencil

How can I do that??
Kindly, find attached the data base.
Sorry for bothering you.

View 4 Replies View Related

AnyOne Help With This?? Join Query

Jan 16, 2008

Hi All,

Head is battered with this join query. I have 2 tables which I want to join, one being individual data and one being budget data. I want to Sum the budget Cost And Budget admissions dependant on the joins.

SELECT FyldeCoastActivity.Speciality AS [Specialty Code], dbo_Specialty.SPECTEXT AS [Specialty Desc], FyldeCoastActivity.GP_Practice, FyldeCoastActivity.[Activity Type], Count(FyldeCoastActivity.Activity) AS CountOfSUSActivty, Sum(FyldeCoastActivity.BasicSpellCost0708) AS BasicCost, Sum([PBC month 8 budget].[Budget Admissions]) AS [SumOfBudget Admissions], Sum([PBC month 8 budget].[Budget Cost]) AS [SumOfBudget Cost], [BasicCost]-[SumOfBudget Cost] AS [Cost Difference], [BasicCost]/[SumOfBudget Cost]*100 AS [Cost %]
FROM ((FyldeCoastActivity LEFT JOIN dbo_Specialty ON FyldeCoastActivity.Speciality = dbo_Specialty.SPECCD) LEFT JOIN [Al Providers] ON FyldeCoastActivity.Provider_Code = [Al Providers].Trust_Code) LEFT JOIN [PBC month 8 budget] ON (FyldeCoastActivity.ProviderCode1 = [PBC month 8 budget].[Provider Code]) AND (FyldeCoastActivity.Speciality = [PBC month 8 budget].[Specialty code]) AND (FyldeCoastActivity.GP_Practice = [PBC month 8 budget].[Pract code]) AND (FyldeCoastActivity.[Activity Type] = [PBC month 8 budget].PODSUS)
WHERE (((FyldeCoastActivity.[Financial Month])<=8) AND ((FyldeCoastActivity.ExcludeReason)=0 Or (FyldeCoastActivity.ExcludeReason)=99 Or (FyldeCoastActivity.ExcludeReason) Is Null))
GROUP BY FyldeCoastActivity.Speciality, dbo_Specialty.SPECTEXT, FyldeCoastActivity.GP_Practice, FyldeCoastActivity.[Activity Type]
HAVING (((FyldeCoastActivity.GP_Practice)="p81129") AND ((Sum(FyldeCoastActivity.BasicSpellCost0708)) Not Like 0))
ORDER BY FyldeCoastActivity.Speciality, FyldeCoastActivity.[Activity Type];

The query is coming back with Very high figures which leads me to believe that the joins are not working and just summing all the data in the budget table.

I have uploaded a screeen shot of the query.

Any help would be much appreciated.

Thanks

View 2 Replies View Related







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