Query Giving ID Instead Of Text In Report

Oct 27, 2014

SELECT Count([Unsafe Act ].[Tag]) AS [CountOfTag], [Unsafe Act ].[Audit], [qryTag].[Tag]
FROM [Unsafe Act ] LEFT JOIN [qryTag] ON [Unsafe Act ].[Tag] = [qryTag].ID
WHERE ((([Unsafe Act ].Date) Between [Forms]![frmSafetyReportOut]![startDate] And [Forms]![frmSafetyReportOut]![endDate]))
GROUP BY [Unsafe Act ].[Audit], [qryTag].[Tag]
HAVING ((([Unsafe Act ].[Audit])=[Forms]![frmSafetyReportOut]![cboConditionAct]))
ORDER BY Count([Unsafe Act ].[Source Of Tag]) DESC;

I am trying to run this query and query works fine however I am trying to run a chart on the report which shows ID's of Tag instead of txt of Tag.

View Replies


ADVERTISEMENT

Giving A Query Parameter Using A Text Box

Nov 8, 2004

Hello everybody!

I 've created a query that copies the records of a table into the same table, creating new records. (I don't know how this is called in english, sorry). For example if have a table with 2 records when the query is run I have 4 records with duplicates. The fields of each record I want to remain the same except for one, called code. For example:
this is the table before the query is run:

surname name code
tracy john 1
spencer bud 1

and this is the table after the query is run:

surname name code
tracy john 1
spencer bud 1
tracy john 2
spencer bud 2

the code is also in an another table and is included in a textbox in my main form. Everything works fine when I run the query but I must type a parameter (code) to create the duplicated table. How can I pass the parameter to the query "automatically", using the textbox value?
Thanx in advance

View 3 Replies View Related

Reports :: Report Giving Duplicate Subreports

Apr 15, 2015

In my database, I have a report called "rptEventsbyEmployee" and in that a subreport called "sbrptEventsbyEmployee". The master/child link is the employee name. Everything is fine until you get to page 3 where the subreport shows twice.

View 5 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

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

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

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

SQL Query Syntax Giving Access Problems

Jul 12, 2005

Can someone tell me where I might be going wrong here. The following query works in SQL, but somewhere in the LEFT JOINS area, Access gets a little confused and says I'm missing an operator.

SELECT Tariffs.TariffCPUCID, Tariffs.TariffID, AdviceLetters.ALCPUCID, Tariffs.ALID, Tariffs.ScheduleID, Schedules.SheetTitle, AdviceLetters.[Filing Date], Tariffs.[C&E], SheetsCancelling.CancellingID, SheetsCancelling.CancellingCPUCID
FROM Tariffs LEFT JOIN Schedules ON Tariffs.ScheduleID = Schedules.ScheduleID LEFT JOIN AdviceLetters ON Tariffs.ALID = AdviceLetters.ALID LEFT JOIN SheetsCancelling ON SheetsCancelling.TariffID = Tariffs.TariffID
WHERE Tariffs.Type="E"
ORDER BY Tariffs.TariffCPUCID DESC;

View 5 Replies View Related

Odd Query Problem Giving Me Grey Hairs.

Mar 10, 2008

I have a query that updates a field on a table with the value in another field. When I run the query from the Access control panel, the query does exactly what it should do, 100% perfect. When I call the query using DoCmd.OpenQuery in VBA in an OnClick function on a form, it does not work properly, only appending certain amounts of information, leaving some fields blank.Can anyone shed some light on this.the SQL for the query is:UPDATE tblHolding SET tblHolding.CostGRV = [tblHolding]![OrderCost]WHERE ((([tblHolding].[Item Code])=[tblHolding]![Item Code]));It populates another field in the same record in the same table as itself.tblHolding is populated by a Subform on the Form that has the button that calls this query when clicked.Hope I am making sense.

View 3 Replies View Related

Queries :: Unique Query Is Giving Duplicates

Aug 4, 2015

I have a unique query which lists all the films that we are screening over the next 3 months. I have added a COUNT field so that I can see how many of each films we are screening.

The problem is that i get duplicates of some films - and this may be because we may hold several copies of some films. I have attached two images which might explain this better!

What I could do with is knowing how to make it so that i get a list of films booked and how many of each, regardless of which copy of the film is used.

The SQL is:

Code:
SELECT DISTINCTROW dbo_Films.[film name], Count(dbo_Films.[film name]) AS [CountOffilm name]
FROM ((dbo_Films INNER JOIN dbo_filmCopies ON dbo_Films.ID = dbo_filmCopies.tblFilms_ID) INNER JOIN dbo_EventsFlicks ON dbo_filmCopies.ID = dbo_EventsFlicks.filmCopyID) INNER JOIN dbo_Venues ON dbo_EventsFlicks.venueID = dbo_Venues.ID
WHERE (((dbo_EventsFlicks.datefield)>=#8/1/2015# And (dbo_EventsFlicks.datefield)<#1/1/2016#))
GROUP BY dbo_Films.[film name], dbo_Venues.southhub, dbo_Venues.northhub, dbo_Films.Specilaised
ORDER BY dbo_Films.[film name];

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

Update Query Giving Me A Runtime Error 3061

Oct 27, 2005

Hi there....Im busy tonight trying to get a couple of things working correctly.

I have an UPDATE string that I am trying to get working but I am getting a runtime error 3061 saying 'To few parameters Expected 1'

I have tried the same query using the query builder and it works ok...when I try it in VBA it doesn't work.

This is my code


Dim SQLUpdate As String
Dim SQLWhere As String
Dim strComplete As String


SQLUpdate = " UPDATE tblPersonalInformation SET tblPersonalInformation.DateModified = Now() "
SQLWhere = " WHERE tblPersonalInformation.PersonalID = [Forms]![frmMain]![txtCandidateNumberReadOnly]"



strComplete = SQLUpdate & SQLWhere
Debug.Print strComplete


CurrentDb.Execute strComplete
End Sub


Can anyone see what I am missing or I am doing wrong?


Thanks evryone for your help.

View 5 Replies View Related

Format Text In Report/query

Sep 10, 2005

How do you format text for output into a report for initial caps?

Thanks much

View 2 Replies View Related

Text Box Button Query To Generate A Report

Jan 23, 2007

Hello all

i need to create a text field and button in a form that will show all the records for a particular JobNo in a report once the txt has been typed and the button is clicked, i.e if I type JobNo001 I need to to create a report showing all the information for that JobNo(but there can be multiple JobNo's).

Do i have to create a query for this. I am new to this so please be gentle

Thanks

Chris

View 1 Replies View Related

Option Button - Use Text Instead Of Numeric Value In My Query/report

Apr 26, 2007

Hello,
I am not sure what cateogory to choose for this question but I would greatly appreciate your help.

I have 5 buttons in my option group:
1. very often
2. often
3. occasionally
4. rarely
5. never

I have to produce a report using description of each button in my report, not numeric value. I heard something about global variable but I am not sure how to do it.

Many thanks,
Debbie

View 1 Replies View Related

Generate Value For Text Field In Report Based On Query

Jan 20, 2008

Okay I have a report (rptHorneOstbergQuestionnaire) that is based on a query (qryrptHorneOstbergQuestionnaire). In the report I have a total (HOTotal) which is the result of an expression created in the qry. Based on this result I would like to generate text in a text field (HOType) that is found in the same report.

Basically if the field HOTOtal shows any vaue between:
16 and 30 then I want the unbound text field to show the text Definitely evening typw and so on ...(see case statement below)

I thought I could do a case statement on report open but I am getting an error that my expression contains no value.

Here is the case statement

Private Sub Report_Open(Cancel As Integer)

Select Case Me.HOTotal

Case 16 To 30
Me.HOType.Value = "Definitely evening type"
Case 31 To 41
Me.HOType.Value = "Moderately evening type"
Case 42 To 58
Me.HOType.Value = "Neither type"
Case 59 To 69
Me.HOType.Value = "Moderately morning type"
Case Else
Me.HOType.Value = "Definitely morning type"

End Select

End Sub


What else can I do?

View 2 Replies View Related

General :: Export Query Or Report To A Delimited Text File

Aug 29, 2012

A little background. I need to export the results of a query I use to build a report. For Print Master software I need the "Field Names" in the text file as well as the data for a Mail Merge in Print Master (PM).

"The field name information in the file you have specified is missing or not correctly formatted. The first line of the file must contain the database field names. Make sure the "Export Field Names" (or similar) option is selected in the program from which you are exporting data."

Trouble is, when trying to export the report or query, Access has no "Export Field Names" option. It works if I first export to Excel and then from Excel to "txt" then to Printmaster. I would like to eliminate the Excel step. Therefore, how do or can I get Access Export to transfer the "Field Names" along with the field data?

View 8 Replies View Related

General :: Text Box On Report To Autofill Using Fixed Text From A Label On Different Form

Jun 23, 2015

I am using Access 2007 and 2010. I would like a text box (or label) on a report to autofil using fixed text from a label on a different (closed) form.

View 8 Replies View Related

Reports :: Find And Replace Text Across Many Text Boxes In Report Design

Jan 30, 2015

Is it possible to use find and replace to modify text in report design - or else is there something else I can do to get the same effect? I have a really useful report and I want to modify it for use with a different dataset. To do that I will need to change the text in over 150 text boxes. I have seven different fields which each occur over 20 times in the control source formulas in the text boxes, because they are used in different ways in different calculations. If this was excel I could do a simple find and replace to change e.g. every reference to fieldname OLD to fieldname NEW, but I cannot see how to do that within access report so am haveing to click on each text box in turn, go to properties and edit the text box .

I am trying to switch to a more general naming system in the modified report so then I will be able to assign data with the required fieldnames for the report within a query. But the report I am starting with has field names based on years 2013, 2014, 2015 etc.I want a quick way to change each reference to those field names to my more generic new field names.

View 2 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

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

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

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 8 Replies View Related

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







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