I have written 2 SQL queries which I wanted to combine using IF-Then statement, if possible.
the first one:
SELECT NewNumber as [Main_number]
FRom try_SQL
Where Type='A' OR type ='V'
The second one is:
SELECT OldNumber as [Main_number]
FRom try_SQL
Where Type<>'A' AND type <>'V'
I want to output the Main_number as a text file on my D drive.
At the moment I have to to output 2 different text files, then combine them.
can someone please help me?
I had a query which used to work perfectly fine, then I changed one of the field names that the query was returning. And then, I rechanged the same field back to what it was and I save it. Later, whenever I run that query, it asks for a parameter with the same field name I changed even though I don't have it anymore.
Can some one please tell me how I can use a delete query. I have the following code, but it does not work. Please let me know where I am going wrong --------------------------------- Dim StrSQL As String StrSQL = "Delete FROM PLANT WHERE PLANT_CODE = ' " & PLANT_CODE_txt & " ' " DoCmd.RunSQL StrSQL ---------------------------------- In the above and below code PLANT_CODE_txt is the form field that I am taking values from to delete from the table
(or)
---------------------------------------- Dim StrSQL As String dim pt_code as string pt_code = me.PLANT_CODE_txt StrSQL = "Delete FROM PLANT WHERE PLANT_CODE = ' " & pt_code & " ' " DoCmd.RunSQL StrSQL --------------------------------------------------------------
And if we are using multiple delete queries should we have the DoCmd.RunSQL <variable> after every delete statement or is it after all the statements
Hi All, Can anyone help me count postcode instances. I have a query that looks at my customers table (tbl_Customer_Details) post code field (PostCode), at the moment I have got it to strip out the right side of the postcode leaving me the left district side eg. HG12 8EN becomes HG12. I would then like to count how many times each postcode instance occurs so I can create a report on the result so I can track which district the customers are coming from. I hope this explains the problem. Any help would be much appreciated as I promised the Boss this for tomorrow....:confused:
this is my SQL so far, it strips out the left of the postcode:
SELECT tbl_Customer_Details.PostCode, Left([Postcode],4) AS Code FROM tbl_Customer_Details GROUP BY tbl_Customer_Details.PostCode;
Original Table ozip dzip shipdate wgt Transport cost
A B 12/1/07 20 450 C D 4/1/08 15 890 E F 9/1/08 78 750 A B 12/1/07 42 789 X Y 1/1/08 17 900 C D 4/1/08 34 90
Needed Output
ozip dzip shipdate wgt Transport cost
A B 12/1/07 20 450 A B 12/1/07 42 789 E F 9/1/08 78 750
I need to create a query which extracts rows with wgt >60 and also WHEN the fields ozip, dzip and shipdate are same, the query should add the wgts and then sum of wgts should be >60- for example the first and fifth rows should be extracted since sum is 62.
I have attached the output that is required for the above example. please help
I have an indexed table (unique autonumber) in Access. I have in this table an other column with every X rows a number (X varies) and the rest of the rows below are empty. This situation repeats again with another number and again all the fields under it are empty. Is there a possibility to run an update query to update all fields below to that certain number? Can you define a range (by using a range in the autonumber) to update all the fields in that range to that specific number ??
Hi Folks, I have a table that has Student_ID, Course, and Grade. So each student has multiple records, one for each course they took. But what I want to return is only those people who have All F's. If I just put "F" as a criteria on the grade field then it will pump out those records that have an F, including those who maybe only have 1 F, but all I want is a list of Student_ID's of all of those people who have nothing but F's. Any ideas? HELP..i'm really in a bind with this one.
How can I get the record with a date field that is the earliest and the latest in a table.
tblSample(ID, Name, Type, ItemDate)
The ItemDate can be any date entered by the user, so the ID will not give me the earliest and the latest record. How do I make a query that will give me the earliest ItemDate and the latest ItemDate. I need to do this in Access. Thank you.
I am trying to create a sequential number field in a query. I cant use an auto number for the fact that i am combining multiple tables. Any help with this would be greatly appreciated.
Not able to add more column heading in cross tab query. I tried to change the query properties to add more column headings as given below. In the query's Design view, right-click up in the area where your tables are shown and choose "Properties" from the right-click menu. The 3rd line down is for Column names. Enter what you need there.
Evn after doing it. i am not able to . Whn I try to save or view the datasheet it says. to create a crosstab query u need to have one or more row headin one column headin and one value.
Hi all, i need some help constructing a query that will create a table for me that does not include the Type value of 'promotion' if the same ID value exists elsewhere within the query.For instance, in the example below, i would want to delete the first entry containing 'Promotion' because ID2001 exists in two other places. However, if only one instance of ID2001 'Promotion' existed in my query, i would want to keep that entry. I would prefer to write all my data to a new table called "Test", This query has to sort out about 1000 entries when executed, otherwise i'd do it manually.I'm pulling my hair out with this one, so could someone help me?ID Company Name TypeID2001 Disc plc John PromotionID2001 Disc plc Paul AgentID2001 Disc plc George Agent
I have a database of employees, sales, products(Sky and Mobile Phone Contracts) and customers(Need to be common and shared between all products). ( A door-to-door marketing company)
Since each product requires different inputting tables, I have inserted all the required fields into the tblSales and then I want to run a query in order to select the needed fields and create a new Sale of a specific product.
However at the same time I want to create a new customer, assign the sale to an employee, select the commission ID that he is going to receive for the job... etc. Well as you can see the problem is that it is not letting me do it due to the fact that an entry is missing in the other table for that client or a client is not yet created for the sale. (Only one autonumber is assigned.)
What am I doing wrong?
Just in case you want to look at my mess... I have attached the DB :P
Hello, I have the following "range" table. I have a "txtBoxA" (numeric) and "txtBoxPrice". I have to look in the table for the corresponding range of "txtBoxA" and retrieve the VALUE for that range and store it in "txtBoxPrice"
LOW HIGH VALUE 1 500 40 501 1,000 70 1,001 2,500 90
Example: "txtBoxA" = 200 then the corresponding VALUE would be 40 and I would have to store 40 in "txtBoxPrice"
How would I do this?? I'm doing this in ACCESS Thank you
My school coursework database is on my memory stick, and i have just opened it, and all my forms, reports and marcos have gone. The file has gone from 12000kb to 10000kb, and a table MSysCompactError automatically created itself. How can i get it all back????? The last time i accessed the memory stick was on the school PC.
I'm developing a small Access 2003 application for a purchase service that includes managing informations about Suppliers, Customers, Carriers, and Orders. With the Orders issue, I'v created a form to enter all the informations about the order; customer, supplier, carrier, orderID, and a subform to enter the items with their quantity and unit price... I want to:
1- Add a botton in the form that opens a Word document; a Purchase Order, that includes all the information entered in the form. 2- Add a botton to send this document as an attachement from Access via Outlook.
I need a guide step by step to understand how it works in Access with examples if is it possible.
the scenario..... is i have a column, let say fieldx some of them have 10 characters that is 00000000a0 others are 8 characters 000000ao and i want the 8 char to be also 10 by adding additional 00? is this possible?
hi my problem is i need query code for Concatenate Column Values from Multiple Rows into a Single row with Access like this Last First Code ------- --------- ---- Lesand Danny 1 Lesand Danny 2 Lesand Danny 3 Benedi Eric 7 Benedi Eric 14
Result should look like:
Last First Codes ------- --------- ----- Lesand Danny 1,2,3 Benedi Eric 7,14
urgent help needed with creating a query please...
I have a table with AutoNumber as primary key. The second column is called ClassID and the third column is called TeacherID. I want to run a select query that finds all records where the ClassID column and TeacherID column match. Basically I want to find records where the fields are duplicated.
How do I do this either through Access query builder or SQL view?
Assume that Price of P1 changed to $40 in Feb. Now I want to calculate amount earned by selling P1 from Jan to March. Remember (For Jan the rate will be $20 and from Feb to March it will be $40) If I calculate manually it will be - 4*$20 + 10*$20 + 20*$40 + 10*$40
Hi guys, im doing a project now, where i have to estimate the service due of cars. For this i need to put a count down timer in one of my FORMS and also REPORTS(sorry about posting about reports in this section but i ddnt want to post twice :rolleyes: but will do if necessary)... i searched a LOT on google but couldnt find anythng..... if some1 could come up with something reasonable, it would be VERY VERY helpful...
Please try to make it before this friday plz if you can...
Hi i have imported an excel sheet in form as an OLEUnbound. The form is for registering product details and the excel sheet iam using for price calculations. But when i register a new product the sheet doesnt clear it shows the same values enterd as in the previous product and when i change them the same thing happens with the previous products. I want to use the same sheet with the calculation differently for all product.B`cus the products doesnt have same price. Any help. I want to use that one sheet instead of making one own sheet for every products. Use the sheet as an mal or something like that.
Plz help.. :confused: i have included a picture of my form. when i should register a new product the sheet should be linked for that product only.
Hy, Ive got problem that drives me crazy. i have form with two combo boxes and text field which shows value from table based on a criteria from those combo boxes.
Can i use Dlookup function with more than one criteria like
I also know how to make a querry in VBA that gives me correct value but i don't know how to put that value(which is currency) in textbox Or is there other way to solve this problem and get correct value Thanks for any help
i need help with a basic problem. Is it possible to link a listbox and a calander, My Main aim is to get a booking board for a hotel database, therefore i want it so that when you click on a particular date, the listbox displays all bookings on that date.
Also i need assistance with using queries for derived entities!! Please help
Hi i have a problem coming up with the ans to the last part of this text. Can anyone help me?
The information technology (IT) department in your school has asked you, a part-time employee at the department, to help create a database to track fundraising activities and donations in your school. In the past, the schools fund-raising foundation has been manually maintaining detailed records of donors and fund-raising activities. The schools president has recently asked the IT department to help computerize the foundations records. Your job is to design and implement the database for the foundation. The following information is captured in the manual records: 1. Individual_Donor name, address, email and phone number. 2. Company_Donor company name, company address, company email address company phone number, main contact, main contact phone number, main contact email and phone number 3. Amount of donation and date of donation 4. The donation can be a one-off donation or a monthly donation (interval of one month from the date of the first donation) 5. Name of fund-raising campaign (New building fund, President fund, Scholarship fund, Bursary fund, Star fund) 1. Draw the ERD and database schemas for the donor database that you will design for the foundation. Decompose the ERD where necessary. You can make any assumptions that are reasonable for the design. Make sure to suggest attributes that should be included but are currently not in the manual system. (5 marks) 2. Implement the ERD in Access. Design the tables for the donor database. If the NRIC number of the individual donor is not available right now, what is an appropriate primary key for the individual donor? Populate your database donor with records. ...................(3 marks) 3. Create an input form(s) for the donor database. In your design of the input form(s), create (a) an input mask for a control and (b) a validation rule for a control (4 marks) 4. Create a report that lists the donations in the order of descending amount of donations. Put in the appropriate donation details. Separate individual donations from company donations. Aggregate the donations for each category ..(2 marks) 5. Perform the following queries on your database. a. What is the largest amount of total donations received over a single month period (first of the month till end of the month) for 2005? b. Which are the company donors that donated on a monthly basis and how much are the donations? c. List the details of individual donors that donated to the New Building and state how much they are donating to the fund and on what dates.