Simple Query Questions
Nov 14, 2006
I hope that this will be simple for you -
I have a table which includes the fields Date of Birth and Age Group.
Age Group is based on the persons age so I created a query (qryAge) to calculate age using the statement: DateDiff("yyyy",[DOB],Now())+Int(Format(Now(),"mmdd")<Format([DOB],"mmdd"))
This query works fine and when i run it it displays each persons age.
Now to calculate the Age group I have created an update query which when run will update the Age Group field, however it does not work. The if statement I have used is -
IIf([qryAge]![Age]<"18","Under 18",(IIf([qryAge]![Age]>"17" And [qryAge!Age]<"35","Under 35",(IIf([qryAge]![Age]>"34" And [qryAge]![Age]<"45","Under 45",(IIf([qryAge]![Age]>"44" And [qryAge!Age]<"55","Under 55",(IIf([qryAge]![Age]>"44","55+")))))))))
If someone could tell me what is wrong it would be very greatly appreciated, as no matter what I try i cannot get it to work!
View Replies
ADVERTISEMENT
May 17, 2006
Hi all, I built a system in access for my a level IT course a few years back but haven't had need to use access since. just been asked to build simple system at work and i'm forgetting some really simple things. trouble is i think i'm overcomplicating the terms and can't find anything in the help file!
basically the system is to keep track of how many hours various people have worked on various jobs.
I've got 3 tables:
Jobs - job id, location etc etc
Staff - staff id, name etc
link - job id, staff id and hours worked.
the job and staff tables have the id as the primary key, and i've set the relationship to link them to the corresponding field in the link table. which is all fine if i remember rightly?!
now what i'm trying to do is set up a form for entring the hours worked etc into the link table. we use job id numbers all the time so i have that as a drop down box. what i want is to have a drop down for employee names, which will insert the employee id into the link table- basically so we can work with names rather than numbers. for the life of me i can't remember how to do it. i know is really simple but i can't find a way to express what i want to do to search for it in the help or online!
if anybody can refresh my memory it would be much appreciated!
View 5 Replies
View Related
May 22, 2006
I am still learning and I have 2 questions.
First...I have a table called company rates which will be used to calculate time and materials. In the material field, I need to enter .10 for 10 percent. When I enter .10 the field changes back to zero. I have it set to long interger. Is this wrong?
Also, I am working on the form that will calculate all of this. I have a field that needs to look in a flex price field. If there is a number in the flex price than that is the labor, if not, it needs to multiply the estimated time (Text43) times the quantity, times the CurrentLaborRate contained in the CompanyRates subform. I can't seem to get it right...
=IIf([FlexPrice]>1,[FlexPrice],[Text43]*[Quantity]*[frmCompanyRates.CurrentLaborRate])
I know it is probably something simple but I can't figure it out. Can anyone help?
THANKS SO MUCH!
View 14 Replies
View Related
Aug 11, 2005
Since this is my first posting, i want to thank all the people who contribute their knowledge to this site.
I'll get to the point now. I have a form that holds fields belonging to 2 tables that are related by the same primary key. This form works fine for data entry purposes. However, i want this form to perform a search function also. The user can type a new Id# in a combo box and then fill in the rest of the fields on the form to create a new record OR choose a Id# that already exists from the same combo box (drop-down) and by doing so envokes all the rest of the fields that are related to the choosen Id# to display their contents, in other words the Id# is used to perform a simple search that displays the data on the same form.
I would appreciate a comprehensive answer because i have already busted my brains on this one for some time now..
help anyone?
View 3 Replies
View Related
Nov 16, 2006
Hello,
I got a simple graph on my form based on the following query:
date | ordercount:
-------------------------
16/11/06 20
15/11/06 18
14/11/06 19
13/11/06 18
10/11/06 19
09/11/06 18
My graph is leaving out the TOP record and my datasheet I get this result:
16/11/06 | 20
-------------------------
15/11/06 18
14/11/06 19
13/11/06 18
10/11/06 19
09/11/06 18
So as you can see, my graph is actually confusing my TOP record with the title and that's why it's not showing. So how can I fix this?
On a sidenote:
As you can see, I didn't work on 11/11 & 12/11 but my graph is still showing those dates but of course with value 0. How can I leave out dates where I created no orders?
Kind regards,
B.
View 2 Replies
View Related
Oct 23, 2006
I'm sorry if I'm asking relatively simple questions. I'm a break/fix guy, and our in house programmers told us it would be 6 months before they could help us out, so we're tackling this chore ourselves.
We have a database of company names along with corresponding contact information. Each company has at least one associated id number. One company may have several numbers, but each number is unique. A very simple creature. I'm using a combo down box to allow the users to search by company name. This box only pulls the distinct company names. There is also a second combo box that has every id number. These are the only two methods used to navigate through the form.
How can I set up these two boxes to "track" each other? Right now, if I select a company name, the id number box doesn't move to its corresponding entry, and vice versca. How can I set these two boxes up to follow one another as a user navigates?
Our second problem might be a little more challenging. Like I said, each company may have more than one id number. We would like to set up a query that would pull all of the company id numbers when a user selects a name using the above drop down box and insert them into a text box.
Any help is appreciated.
Thanks!
View 2 Replies
View Related
Sep 11, 2007
Hi
-Is is possible to make a parameterized cross-tab query? I want only to display data between certain dates and for a specific crew.
-Also, for data in the query I have the Line number (of the machine) as the row headers and the Problem names as the column headers. I also want to display the problem CATEGORIES (of the problem names) above the names. How do I do this???
:confused:
View 7 Replies
View Related
Apr 5, 2013
I have two tables containing (let's say for simplicity) questions and attachments (pictures). I am trying to perform a union query to join all the questions and pictures into one report, but it won't let me union the attachment because 'the multi-valued field 'TableA.Pictures' cannot be used in a union query'.
I have searched and searched for a solution (and got kind of close) but i still can't get it to work. The best I can do is union everything like below, which gives all the questions as desired, but says #Error in the pictures column:
SELECT TableA.*
FROM TableA
Union
SELECT TableB.*
FROM TableB;
(Note tables A and B have the same structure, several yes/no and open text questions as well as one attachment field. )
View 8 Replies
View Related
May 11, 2005
Hi there,
I have a really simple question.
I have a field in a table that contains comments (text format). I want to run a query where I can get only the records that contain the word "high" in the comments. There may be some typos so I would like records returned that also contain something like "high". High is not the only word in the comments.
Does this make sense?
Thanks,
Row
View 4 Replies
View Related
Jul 26, 2005
Hi guys, wondering if you could help me, I can't seem to get this right..
I have two tables in question:
Items: StyleTypes:
------ ------------
ItemID ItemType
ItemType StyleType
Style
Lots of Attributes
ItemType is a list of items (Table, Desk, Bookshelf, Chair)
Style is a type of style for the item (Circular table, Radial Desk)
I want to create the Items.Style field based upon a query of the StyleTypes. So if a user types "Desk" in Items.ItemType then the Items.Style field will be limited to only those Styles which match that selected item within the StyleTypes table.
Think thats clear enough, but my attempts have all failed, hope you guys can give me a push in the right direction, thank you!
View 4 Replies
View Related
Apr 5, 2006
Hi all,
I have very little knowledge of databases and even less about writing queries.
The problem:
I have a database that lists cities (such as Paris, London, New York etc) as rows and employment status (Full-time, Part-time, Unemployed etc) as columns.
I need to go through each city and record which employment status is greatest (for each city) and present it in a new column. I can do this manually but I’m sure a query can be created to automate the process.
Hope that all made sense. Can anyone suggest ideas on where to start?
Many thanks,
Carl
View 1 Replies
View Related
May 6, 2006
hi
have just designed a rather simple music database for my dad to use at home as he has large collection.
have a table with the heading"artist" and another one with "album" ...my problem is that on the table there maybe 1 or more instances with the same artist but with different albums...when i run a simple query for ..say artists starting with the letter"a" i may get about 10 cases of the same artist appearing in my query when all i want is one...(depending on if i may put in say one artist like abba having 10 albums etc)...i am entering each artist with the album each time so i may enter the artist in say 10 times....depending on how many albums etc
if you understand all that...i would be grateful if someone could help me with a simple query
alan
View 7 Replies
View Related
Jul 4, 2006
I have a query that returns the uncompleted jobs from a single table ( its a calls database)
all i need is query that returns the amount of uncompleted jobs onto the switchboard I.E whatshername has X amount of uncompleted jobs , i have done a search and most of the solutions are very complicated for what i want to do .....anyone any ideas ?? pls
View 2 Replies
View Related
Jul 6, 2006
Thanks in advance to anyone who helps.
SQL and Access are both new to me. I have purchased some books (which are still in the mail), and have gone through this forum (which seems to be a little more advanced for me at this moment).
I have a database that contains Business_Unit (Store Numbers), Post_Date (Last Date of Inventory), and other misc. stuff. Anyways, My goal is to pull the latest date of inventory for each individual store before the last ninety days. What I have so far:
SELECT DISTINCT informix_shrink_head.business_unit, informix_shrink_head.counting_event_id, informix_shrink_head.post_date, informix_shrink_head.delta_cost, informix_shrink_head.delta_count, informix_shrink_head.count_reason_cd, pcw_loc_master.closed
FROM informix_shrink_head, pcw_loc_master
WHERE (((informix_shrink_head.post_date)<=Date()-90) AND ((pcw_loc_master.closed) Is Null))
ORDER BY informix_shrink_head.business_unit;
However, I get the same store multiple times and for multiple post dates.
I do not even know if this can be done in one simple swoop, or if I need to create another table and re-query that? Any assistance or comments would be much appreciated.
Thanks,
A Gator
View 1 Replies
View Related
Sep 11, 2006
Hi guys. I have been away a while and boy am I rusty.
I would like to show how many available licenses there are. Here is what I have:
Software (Office 2003)
license purchased (8)
license used (2)
I added an expression along the lines of:
Available: Sum([tblSoftware]![Number of licences purchased]-[tblPC-LicenceRelation]![Number of licences])
This gave 14 and not the desired result of 6!!!
Simple I am sure!! :o
Phil.
View 4 Replies
View Related
Sep 26, 2006
Hi Guys,
I have a database that collects information on products when engineers return them, what I need to do is when they have submitted the form, email it to 3 people so that the paperwork can be raised.
I understand that I will need to create a query to display just the last record and then email it.
So the idea is when a record is created and the engineer clicks submit the last record then gets emailed to the three people.
Please be gental with me im still quite new to all this.
How do i create a query that just displays the last record?:confused:
Thanks in advance.
Rich
View 1 Replies
View Related
Nov 21, 2006
I built an update query that adds two strings of text together with a _ inbetween.
eg
field1 = Hello
Field2 = Jamie
after update= Hello_Jamie
This works fine but when i attempt to run the code in SQL on an after update instance i can't get it to compile
The SQL straight from the working Update query is:
UPDATE tblPID SET tblPID.PIDPIDNoRev = (tblPID.PIDno)+"_"+(tblPID.PIDRev);
I have tried quite a few different ways and believe it to be a probelm with the speech marks or underscore
DoCmd.RunSQL "UPDATE [tblPID] SET [tblPID].PIDPIDNoRev = (([tblPID].PIDno)+"_"+([tblPID].PIDRev));"
anyone got any ideas? i'm sure it's pretty simple
Thanks, Jamie
View 2 Replies
View Related
Dec 29, 2006
HI,
I am sending ZIP file in attach with files in it. I would like some help to change the 'Q_test' query so that I can get the result shown in the excel file.
Regards,
Elio
View 1 Replies
View Related
Jan 4, 2007
Hi,
I think i am being a bit thick, all I want to do is create a report of projects without products....
I have a table of Projects (customer name, details etc...)
I have a table of Products (product name, config, details etc....)
Every project will eventually have one or more products allocated to it...
How can i query the database for:
'select all projects created without any assigned products... yet'
I'm having a post xmas block!!!
Thanks
View 1 Replies
View Related
Mar 9, 2007
Hi there..
I need a simple query...
I want all the records to appear which have some text in that particular field. So if there is no text in that field, it won't come up. What would I need to write under that field in the query?
View 5 Replies
View Related
Nov 16, 2007
Hi,
I am trying to run a query to retrieve all rows in all tables using a row called Project Status. I am however not able to retrieve any data what so ever with the wizard and by using the limited sql I know. I have attached a copy of my tables if it helps.
The relationships are as follows: Release to PCR - One to many, Sponsors to PCR - One to many. The column i want to filter on is Project_status located in the PCR table.
Does anyone have any ideas how i can do this plz?
Thanks in advance for any help!
Ket
View 1 Replies
View Related
Dec 9, 2007
I wish to create a very simple query but cannot find the correct syntax mentioned in any documentation.
The WHERE clause needs to have the effect of ignoring certain records in a table ie
WHERE fieldvalue <> 12 AND fieldvalue <> 23 AND fieldvalue <> 37 etc etc for up to an unspecified number of values.
Is the above the correct syntax (very tedious to construct in expression builder or natively) or is there something more simple available such as
WHERE fieldvalue <> (12, 23, 37 ......)
Many thanks
View 3 Replies
View Related
Feb 25, 2008
The following query never returns, even though there is an index on the name field in the Patient table:
SELECT p.Name FROM sheet4 AS s INNER JOIN Patient AS p ON p.NAME LIKE s.LASTNAME + ', ' + s.FIRSTNAME + ' %'
View 4 Replies
View Related
Nov 3, 2005
Hi
I am re-visiting access for the 1st time in a couple of years to develop a quotations system and I am just messing around at the moment with Northwind trying to work out how it all works.
I have come across a problem that is baffling me....
When displaying the order details table (referenced from products), the product ID is disoplayed in text form, not as a number. Whenever I try and do this with 2 similar tables using the query builder I always get just the other tables number. I have no idea what I'm doing wrong as every field, attribute, join etc seems to be just the same as the sample tables.
Please could someone help a duffer? :)
View 3 Replies
View Related
Jun 3, 2005
I apologize, I know this has been covered. But I just spent half an hour reading old posts and still can't quite decide how to apply it to what I'm doing.
I have a db that logs surgeries and all their details. One of the new things they want to do is be able to run a list of average cost for a certain surgery, since patients are always asking ahead of time how much it will cost. I have a query (and report that runs from it) that will list all the surgeries and total charges for individual ones for a date range the user specifies. But I can't figure out how to make it calculate an average charge for each surgery. I could if there were always a certain number to divide by, but of course there could be 2 of this type of surgery and 57 of that type.
The query I currently have set up is:
Field: MR#
Table: SurgeryLog
Field: Wname: [LastName] & ", " & [FirstName] & " " & [Initial]
Table:
Sort: Ascending
Field: OperationDate
Table: Surgery Log
Criteria: >=[Enter Start Date]
Field: PatientType
Table: SurgeryLog
Criteria: "SDS"
Field: TotalCharges
Table: SurgeryLog
Criteria: >0
Field: Operations: [Operation1Performed] & Chr(13) & Chr(10) & [Operation2Performed] & Chr(13) & Chr(10) & [Operation3Performed]
Thanks much!
View 1 Replies
View Related
Jul 29, 2005
Hi guys,
A friend of mine has recently created a simple database which holds details of childrens story books. It logs the name of the Author, the storyline, its character etc in various tables...
He's currently creating some simple queries for his database. However, there is one query which neither he nor I can figure out, I'll try to explain to the best of my ability.
Basically, the 'story line' field in his database explains the basic plot of the book, some of the plots have the words "son", "dad", "father" and "boy" in them.
Now, he wants to create a simple query, which looks up and displays data which contains the keywords "dad", "father", "son" etc in them. So far he's tried...
Like "*Son*" Or Like "*Father*" etc...
This worked, briefly. The query was bringing up storylines with both contained the words "son" and "father" , which is correct. However, the query was also bringing up story lines with the word "song" in them, or any word which remotely related to one of the keywords, but didn't contain the exact criteria in the query (son, father etc).
In basic terms, how do you create a query which only brings up words that match the EXACT query criteria? In this case, 'Son' or 'Father' or 'Dad' etc? Rather than words which only briefly relate to the criteria, such as 'Song' or 'Fat' etc?
Thanks for your cooperation, feedback and examples would be highly appreciated.
Thanks all,
Jonathan.
View 4 Replies
View Related