A Basic Delete Query Request

Jun 5, 2006

Hi All,

I have two tables; "Section_Failure_Mode" and "Risk_Assessment". They are linked by a common field called section_failure_mode_id. I would like to write a query where you can delete every record in "Risk_Assessment" where the checkbox (called Selected) is not selected (i.e. equal to 0) in the table "Section_Failure_Mode". However, I do not want any records to be deleted from "Section_Failure_Mode", only from "Risk_Assessment".

I have put a link to the screen cap of the query I have tried below. Is this the correct way to do it?

13797

Best Regards,

Aaron

View Replies


ADVERTISEMENT

Visual Basic Delete Query

Oct 20, 2004

Hello,
I am hoping someone might be able to help me out. I am trying to create a delete query in VB for access.
I have managed to get it to run the delete query, but I would like to program in the responses to the following questions:
"You are about to run a delete query that will modify data in your table. Are you sure.... Yes"
"You are about to delete X row(s) from the specified table. Yes"

Here is what I have so far:

Private Sub Command32_Click()
DoCmd.OpenQuery "DELETEQUERY", acViewNormal, acEdit
End Sub

Does anyone know how to do this???
Thanks,
Jason

View 2 Replies View Related

Queries :: Basic Delete Insert Select Statement

Nov 8, 2013

what is wrong with the following statements. I'm new to access SQl. This would work in ms sql.

Code:
DELETE from Table1
INSERT INTO Table1(email, productid, datecreated, datesend) values ('adf', 5, '10/10/2012','10/10/2012')
Select * from Table1

View 1 Replies View Related

Another Query Help Request

Oct 26, 2006

I have a query which selects a complete list of companynames and producttypes, and another query which selects a few companynames and producttypes. What would be the query to select the companynames and producttypes from the first query that do not include the companynames and producttypes from the second query?

View 2 Replies View Related

Urgent Help Request On Query !!!! Please

Jun 5, 2006

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;


What do I add to do the count?

View 5 Replies View Related

Request Assistance With A Query On A Date Field

Feb 22, 2006

I am looking for assistance creating a query on a date field that will go
back three business days from the current date. It must not show inclusive
days, as in yesterday and the day before. Just the 3rd day past and not
counting weekends. Also holidays would need to be considered.
Thanks for any assistance
RW

View 3 Replies View Related

Reports :: Hidden Query Request In Report Design

Nov 20, 2013

I am trying to discover the code that is asking for a phantom query in Subreports. Each Subreports control source query works fine.

I have attached two zipped files

1. Database stripped to send
2. SnapShots of the problem.

View 7 Replies View Related

Query Lets Me Delete But Doesn't Actually Delete...

Apr 2, 2007

I have a query based on two tables, joined on one field (this field is the primary key in Table A. Table B doesn't have a primary key). When working inside this query, it gives me the option to delete records. However, when I try, the row disappears from the query but then if I save and close and either re-open table A or the resulting query, that record is back. It doesn't actually delete. If I go to table A directly and delete it, it's gone for good.

How can I make it so that when I delete the record inside the query it actually deletes? And if that's not an option, can I make it so that it doesn't seem like I can delete records inside the query so that people don't make the mistake?

View 2 Replies View Related

Very Basic Query

Sep 20, 2005

I have written a basic query that looks at the date field, department field and cost the cost field on a table. What I would like is a form that you can chose a date (19/09/2005) and a it looks at the table and calculates the total sum of money for each department for this date. Ie.

Date: 19/09/2005

Dept 1 = £123.00
Dept 2 = £1234.00
Dept 3 = £123.00
Dept 4 = £1234.00
Dept 5 = £123.00
Dept 6 = £1234.00

I can get the query to work but only 1 department at a time. Any ideas?

I have attached the DB

Thanks
D

View 6 Replies View Related

Basic Sql Query

May 22, 2006

Hello all This is a pretty basic query I guess but I am having trouble solving this.. Can anyone help plsssssssss.
I have two tables
Table1
Code Serial_No Amount1 Amount2
1 ABC 100 200
1 ABC 720 220
4 ABC 150 112
9 PQR 11 25
9 ZZZ 122 44
9 ZZZ 1250 42

Table2
Code Serial_No Amount1 Amount2
1 ABC 24 20
1 PPP 72 22
4 ABC 15 12
9 PQR 11 54
9 ZZZ 22 44
9 ZZZ 150 99
and total of the amount as 844 and 440

I have write a query to select only the Code common to both the tables and add total of amounts for these codes. For eg. I want rows
Outpput
1 ABC 100 200
1 ABC 720 220

1 ABC 24 20

Thanks in advance

View 4 Replies View Related

Help Building A Basic Query...

Sep 20, 2005

OK, here's the deal. I have two data tables, one of which holds many types of customer information and has a very large number of records, including, name, address, phone, and email. The other table contains only email addresses. Each email in the second, smaller table corresponds to a record in the larger list , by virtue of both records sharing the same email address (primary key?). I need to be able to take a short list of email addresses from one table and produce all of the records from the larger table that have corresponding email addys, essentially. Can somebody shed some light on how I can structure a query to solve this dilemma? Sorry for the newb question, just getting started out using db's.. Thanks!

View 1 Replies View Related

Basic Query Question

Aug 10, 2006

Hello, i have a small database thats purpose is to show when a book has been returned to me. I am recording the date that books are loaned out. Books are loaned for a 2 week period. I dont know if it would be easier to just manually put in the date that books should be returned (so that means just manually calculate what the date will be 2 weeks later). The reason for this is because i want a query that shows when the date has passed and how many days overdue the book is. Would this be difficult to achieve? What i was thinking is a query that calculates when the 2 week period is up and adds the unique number for book in a report.

Can anyone help?

Thanks,
Marley.

View 2 Replies View Related

Basic Query Question

Nov 28, 2006

i have a very basic query question that i can't seem to figure out.

i have two tables that have a one-to-many relationship - one has patient ID's, and the second table has test results for each patient.

i would like to query for all positive test results - however, if a patient EVER had a positive result, i want ALL records for that patient returned.

thus, if a record in the "many" table meets a particular criterion, i want it to return all records with the same ID. does that make sense?

thanks in advance...

View 6 Replies View Related

Basic Update Query

Jul 11, 2007

hi..

quick question...

i want to update all the records in a certain field..

to make the first letter of each word a capital

to make every letter a capital

i know how to make un update query, what to i put in the criteria if the field is called

field1

cheers

View 5 Replies View Related

How To Delete Record Using Delete Query

May 19, 2011

I have two simple tables. I want to delete the records from Table1 that are on Table2. I've created a select query that gives me what I want but when I change to a delete query, I get this message: "Unable to delete from specified tables"

I think my problem has something to do with security but I can't figure out what to change.

View 13 Replies View Related

Can Someone Please Explain Basic Query Logic To Me?

May 11, 2006

I am not sure if I understand this...

I have MainTable, on which I base MainForm. I would like to have MainForm show only the records that have a null value in CertainField. If I write NullQuery to select only those records, can I redirect MainForm to NullQuery? Well, I know I can do that... but how does MainTable get updated with new records if MainForm is based on NullQuery????

Any help is greatly appreciated.

Tom

View 4 Replies View Related

Using Access Query In Visual Basic?

Sep 18, 2006

I have an access Query(named newSerial) :
SELECT TOP 1 (Productbase.Serialnumber+1) AS Expr1 FROM ProductBase
ORDER BY (Productbase.Serialnumber+1) DESC;

I want to access this new value. Its not a key since an autonumber may be any number. When I create a new product. How do I get this value inside a form?
It works fine when clicking on it. But if I use an unbound box I get 1 as result and not like 76067 which it should be. If I click the query in access it works fine and show 76067.
I tried:
outbox=Expr1
' gives null
'or
outbox=[newserial].[Expr1]
' which gives "Access cant find the field "|" refered to you in your expression"

What should I write? Whats the correct expression?

View 7 Replies View Related

Basic Access Query Question

Sep 10, 2004

Is it possible to use a value on an Access driven form as a parameter in a pass through query?

View 4 Replies View Related

Basic Query Form, Foreign Key Field

Oct 18, 2006

hello.. i have 2 tables

CUSTOMER TABLE
customerid
customername
customerphone


BOOKING TABLE
bookingid
bookingdate
customerid


At the moment i have 2 forms.. one customer form based on the customer table and one booking form based on the booking table.

at the moment, my user enters a customer record using the customer form.. they then save and close the customer form..

they then open the booking form.. and in the customer id field they enter the customers id.. this way, they successfully register that customer to that booking..


what i want to do is allow the user to enter the customer details and the booking details in one form..

i assume i would have to create a third form based on a query..

if i include all the fields from both tables in this query.. and then make a form based on this query, how can i make the following 2 things happen..?

1. when the third form is opened and customer details are entered... a new customer record will be added to the customer table (with a new customerid)..

2. this id will then need to be auto placed into the foreign key customer id field in the booking table.


do you get me?

View 3 Replies View Related

Queries :: Basic Date Selector Query

May 10, 2013

I'm attempting to create a very basic database for a school project. It is a property management database, and I am attempting to create a query that selects properties listed within the last 45 days. I'm unsure how to code this in the build field of the query.

Field: Date_Available
Table: Property_Table
Sort:
Show: (Ticked)
Criteria: (This is the part I am trying to code but am unfamiliar with the syntax)

View 1 Replies View Related

Queries :: Undefined Function In Query And Visual Basic

Apr 3, 2014

I'm doing some debugging over the phone.My friend has Access 2003.What does not work:When he codes the MID function in a query he gets an error like this:"Undefined function 'Mid' in expression."

In the Visual Basic editor, he gets the same error: MID is undefined.What DOES work:I walked him through the use of LEFT and RIGHT in the query and they work.In Excel, MID works.Might there be some odd ball Access configuration mess up, or maybe more likely, his Access installation is incomplete.

View 3 Replies View Related

Help Request

May 8, 2006

Hi:

I'm working with MS access only in very basic things.
Rigth now I need to look some information in a Table that was created in MS Access 2000.I don't know if this is a problem with MS Access 2003, because i still have some ones.
1) The Zoom tool is not accessible.
2) The order of the items, change all the time and I need to sort them every time.
If someone could help me in this matter, I'll appreciate so much

Thanks

View 5 Replies View Related

Yet Another Request For Help From A New User

Sep 20, 2005

Hello all. This is my first post on here after reading many of the other threads as I try - often in vain - to pick up access.

I am in the process of building a couple of databases, the main one being one that is an amalgamation of 4 other/older mdb's. All tables/queries etc were simply imported from these older defunct mdb's and then are archived off every month so they have 3months data and no more in them. The only thing is when it comes to problem solving and/or new queries, it is impossible to tell which tables/queries relate to which sections of the Db.

So my question to you is can I rename tables and queries in any way so that any queries that are using these tables are updated at the sametime, and if so how is it done? I have asked my colleague who is working with me to develope my understanding of access and he is at a loss. We are in the process of trying the old fashioned way ..... getting a book from the libarary ... but thought I'd try this new fangled internet thingy first :D .
The thought of having to trawl through around 100 tables and queries to rename or even re write the entire query/formulae is so daunting, I simply dont have that amount of time. Im using Access 97 and would greatly appreciate any help on this.
Thanx

View 2 Replies View Related

Request For Help On Database Design

Oct 6, 2006

To all you access Gurus

I have been asked to look at setting up and access database to do the following

To keep a record of pupils and 9 tasks the pupils have to do and also the total amount of time it took a pupil to do this task
They have a total of 25 Hours to do all tasks but this is spread out over the year.

What I need is someone to tell me the best table layout to do this

The pupil record has to have the following
First Name
Surname
Form
Total Hours taken for all 9 Objectives
A description of what the pupil did to achive each Objectives
record if that task is complete
Also Date Task was Complete

I have done a test database with just one table in it and inside that table
had all of the above but apart from name, form and total hours I repeated the rest nine times.
This just does not seem right

What I want is to pull up the pupil name and then select Task say from a Drop down box this would then insert a new field if it did not allready exist in pupil recored and then you can fill in the task details of course if the field/s all ready existed then to open that up to allow you to update this

It would then need to update the total Hours field in the pupil record with the hours it took to do that task/objective.


I have basic Access knowledge but i cannot think of best way to achive this can anyone help please


Stuart Purvis
ICT TECHNICIAN
HILBRE HIGH SCHOOL

View 3 Replies View Related

Bizarre Table Request!

Oct 4, 2007

Hi,

First time on here, so hello all!

I have a very strange request from a client who wants to do something simple that they can't because of poor database design (not mine!) . I can't think of an elegant solution so I'm wondering if anyone on here can?

They have multiple tables containing address information, for example they have one containing information about certain buildings. They can use the softcopy of the database to retrieve information about the building but for backup they now need a hardcopy.

Now part of the building information includes the alternative names for buildings (for example "City Museum" and "Art Muesum" might be different names for teh same building). The hard copy needs to have a line entry for both names (proper and alternative) and this is where the difficulty lies.

Using a simple example the table might be:

colour fruit
red apple
orange
yellow banana

The output I would need in the report is therefore:

Red (Apple)
Apple (Red)
Orange ()
Yellow (banana)
Banana (Yellow)

Now I may be being dense but I can't see how I can do this! All help very gratefully recieved :)

View 1 Replies View Related

Password Request On Form?

Apr 14, 2005

i have a curious and annoying problem :eek:

I have a Access 2000 db, been working fine for 6 months+ and suddenly today, two out of three forms give "not a valid password" error on trying to open them.

There has never been a password set on the db, nor on the forms - and the same user who used it successfully yesterday now gets this error, along with any other users.

What has happened and how do i fix it? All ideas welcome!!

Sham :confused:

View 5 Replies View Related







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