Apend/Delete Query using multiple fields criteria

SteveBB

New Member
Joined
Dec 28, 2011
Messages
11
Hi,

I have an access database and I want to move a number of records from 1 table to another based on 2 fields (Start Date & End date)

I'm fine with moving records based on criteria in a single field but can find nothing when it comes to using 2 fields.

here's what I'm trying to do in a nutshell

Append full record if Start Date <20150101 & End Date >20150630.

Once apended I'll then need to run a delet query using the same criteria.

Please help :)
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
How do you add criteria for a single field? You just do the exact same thing under the second field.
In the Query Builder, you would just add each field, and place the corresponding criteria under each one of these fields.
Note if you are using hard-coded dates in your criteria, you need to use Date Qualifers (#).
See the second section here for examples: https://support.office.com/en-ca/ar...-queries-aea83b3b-46eb-43dd-8689-5fc961f21762
 
Upvote 0
Hi,

Thanks for the below - Looks like I was doing it right but have found an issue with one of my data fields. Due to the size of the data I converted everything to text except one of the date fields which I converted to number.

Guess I'll have to re-import all 1mil+ regords again and start over (not enough resource to convert :P)

How do you add criteria for a single field? You just do the exact same thing under the second field.
In the Query Builder, you would just add each field, and place the corresponding criteria under each one of these fields.
Note if you are using hard-coded dates in your criteria, you need to use Date Qualifers (#).
See the second section here for examples: https://support.office.com/en-ca/ar...-queries-aea83b3b-46eb-43dd-8689-5fc961f21762
 
Upvote 0
ok - back again.

I've re imported my raw data and due to the nature of the data the "Dates" have been imported as numbers (Date is in reverse order YYYYMMDD).

I've se t up a standard append query as suggested above adding both fields with criteria and in SQL view it looks fine.

INSERT INTO [Still Active]
SELECT [All Customers].*
FROM [All Customers], [Still Active]
WHERE ((([All Customers].Field14)<20150101) AND (([All Customers].Field6)>20150531));

When I run the query though I'm getting 0 results but I'm expecting close to a million????
 
Upvote 0
Fixed it :)

Wondered why in SQL view it had [Still Active] in FROM. deleted that and it worked. No idea why it put that in though as I could nto see it in design view and after removing it I dont see anything different in design view.

Oh well. All is now good :)

ok - back again.

I've re imported my raw data and due to the nature of the data the "Dates" have been imported as numbers (Date is in reverse order YYYYMMDD).

I've se t up a standard append query as suggested above adding both fields with criteria and in SQL view it looks fine.

INSERT INTO [Still Active]
SELECT [All Customers].*
FROM [All Customers], [Still Active]
WHERE ((([All Customers].Field14)<20150101) AND (([All Customers].Field6)>20150531));

When I run the query though I'm getting 0 results but I'm expecting close to a million????
 
Upvote 0

Forum statistics

Threads
1,221,849
Messages
6,162,425
Members
451,765
Latest member
craigvan888

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top