473,396 Members | 2,140 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Insert Into

I'm fairly confident in my knowledge of SQL but I'm stumped with regards
with an Insert Into statement in Access 2003. I've got a 4 column table
that I've simplified about as much as I can, no primary key, no indexes(at
least I don't think I have any), allow duplicates, allow zero length fields,
the fields in the new table are of the same type of the fields in the old
table, etc. Maybe someone can give me an idea as to what I'm doing wrong.
MS Access I've noticed doesn't give me any error messages to tell me what
I'm doing wrong. The only way I can tell it's not working is by checking
the table and seeing it's still empty.
When I run the Select statement by itself, it's returns what I want but for
some reason, my table still remains empty. Any sugestions?

Insert Into [Data Units TW Inuvik] (SType, Owner, Area, Unit)
SELECT [Data Units].Stype, [Data Units].Owner, [Table Owner].Area, [Data
Units].Unit
FROM [Table Owner] INNER JOIN [Data Units] ON [Table Owner].Owner = [Data
Units].Owner
WHERE ((([Data Units].InDate)<=#8/31/2004#) AND (([Data
Units].TmDate)>=#8/31/2004# Or ([Data Units].TmDate) Is Null) AND (([Table
Owner].Area)="Inuvik") AND (([Data Units].Unit)>=8677770000 And ([Data
Units].Unit)<=8677779999) AND (([Data Units].Template)<>"PRPD")) OR ((([Data
Units].InDate)<=#8/31/2004#) AND (([Data Units].TmDate)>=#8/31/2004# Or
([Data Units].TmDate) Is Null) AND (([Table Owner].Area)="Inuvik") AND
(([Data Units].Unit)>=8676780000 And ([Data Units].Unit)<=8676789999) AND
(([Data Units].Template)<>"PRPD"))
GROUP BY [Data Units].Stype, [Table Owner].Area, [Data Units].Owner, [Data
Units].Unit
ORDER BY [Data Units].Stype;
Nov 13 '05 #1
6 3079
How are you running this query? By opening the query from database window?
From VBA code or macro? Post more details about your process.

--

Ken Snell
<MS ACCESS MVP>

"efgh" <ef**@neverland.com> wrote in message
news:so********************@nnrp1.uunet.ca...
I'm fairly confident in my knowledge of SQL but I'm stumped with regards
with an Insert Into statement in Access 2003. I've got a 4 column table
that I've simplified about as much as I can, no primary key, no indexes(at
least I don't think I have any), allow duplicates, allow zero length fields, the fields in the new table are of the same type of the fields in the old
table, etc. Maybe someone can give me an idea as to what I'm doing wrong.
MS Access I've noticed doesn't give me any error messages to tell me what
I'm doing wrong. The only way I can tell it's not working is by checking
the table and seeing it's still empty.
When I run the Select statement by itself, it's returns what I want but for some reason, my table still remains empty. Any sugestions?

Insert Into [Data Units TW Inuvik] (SType, Owner, Area, Unit)
SELECT [Data Units].Stype, [Data Units].Owner, [Table Owner].Area, [Data
Units].Unit
FROM [Table Owner] INNER JOIN [Data Units] ON [Table Owner].Owner = [Data
Units].Owner
WHERE ((([Data Units].InDate)<=#8/31/2004#) AND (([Data
Units].TmDate)>=#8/31/2004# Or ([Data Units].TmDate) Is Null) AND (([Table
Owner].Area)="Inuvik") AND (([Data Units].Unit)>=8677770000 And ([Data
Units].Unit)<=8677779999) AND (([Data Units].Template)<>"PRPD")) OR ((([Data Units].InDate)<=#8/31/2004#) AND (([Data Units].TmDate)>=#8/31/2004# Or
([Data Units].TmDate) Is Null) AND (([Table Owner].Area)="Inuvik") AND
(([Data Units].Unit)>=8676780000 And ([Data Units].Unit)<=8676789999) AND
(([Data Units].Template)<>"PRPD"))
GROUP BY [Data Units].Stype, [Table Owner].Area, [Data Units].Owner, [Data Units].Unit
ORDER BY [Data Units].Stype;

Nov 13 '05 #2
I'm trying to run it from from the database window.

"Ken Snell" <kt***********@ncoomcastt.renaetl> wrote in message
news:a6********************@comcast.com...
How are you running this query? By opening the query from database window?
From VBA code or macro? Post more details about your process.

--

Ken Snell
<MS ACCESS MVP>

"efgh" <ef**@neverland.com> wrote in message
news:so********************@nnrp1.uunet.ca...
I'm fairly confident in my knowledge of SQL but I'm stumped with regards
with an Insert Into statement in Access 2003. I've got a 4 column table
that I've simplified about as much as I can, no primary key, no
indexes(at
least I don't think I have any), allow duplicates, allow zero length

fields,
the fields in the new table are of the same type of the fields in the old
table, etc. Maybe someone can give me an idea as to what I'm doing
wrong.
MS Access I've noticed doesn't give me any error messages to tell me what
I'm doing wrong. The only way I can tell it's not working is by checking
the table and seeing it's still empty.
When I run the Select statement by itself, it's returns what I want but

for
some reason, my table still remains empty. Any sugestions?

Insert Into [Data Units TW Inuvik] (SType, Owner, Area, Unit)
SELECT [Data Units].Stype, [Data Units].Owner, [Table Owner].Area, [Data
Units].Unit
FROM [Table Owner] INNER JOIN [Data Units] ON [Table Owner].Owner = [Data
Units].Owner
WHERE ((([Data Units].InDate)<=#8/31/2004#) AND (([Data
Units].TmDate)>=#8/31/2004# Or ([Data Units].TmDate) Is Null) AND
(([Table
Owner].Area)="Inuvik") AND (([Data Units].Unit)>=8677770000 And ([Data
Units].Unit)<=8677779999) AND (([Data Units].Template)<>"PRPD")) OR

((([Data
Units].InDate)<=#8/31/2004#) AND (([Data Units].TmDate)>=#8/31/2004# Or
([Data Units].TmDate) Is Null) AND (([Table Owner].Area)="Inuvik") AND
(([Data Units].Unit)>=8676780000 And ([Data Units].Unit)<=8676789999) AND
(([Data Units].Template)<>"PRPD"))
GROUP BY [Data Units].Stype, [Table Owner].Area, [Data Units].Owner,

[Data
Units].Unit
ORDER BY [Data Units].Stype;


Nov 13 '05 #3
I've tried inserting a row of values into the table, rather than using the
select statement and it worked, however, when I looked at the values in the
table, the column headers all got changed to EXPR1(Or something like that,
essentially, the column header got changed), EXPR2, etc..

"Ken Snell" <kt***********@ncoomcastt.renaetl> wrote in message
news:a6********************@comcast.com...
How are you running this query? By opening the query from database window?
From VBA code or macro? Post more details about your process.

--

Ken Snell
<MS ACCESS MVP>

"efgh" <ef**@neverland.com> wrote in message
news:so********************@nnrp1.uunet.ca...
I'm fairly confident in my knowledge of SQL but I'm stumped with regards
with an Insert Into statement in Access 2003. I've got a 4 column table
that I've simplified about as much as I can, no primary key, no
indexes(at
least I don't think I have any), allow duplicates, allow zero length

fields,
the fields in the new table are of the same type of the fields in the old
table, etc. Maybe someone can give me an idea as to what I'm doing
wrong.
MS Access I've noticed doesn't give me any error messages to tell me what
I'm doing wrong. The only way I can tell it's not working is by checking
the table and seeing it's still empty.
When I run the Select statement by itself, it's returns what I want but

for
some reason, my table still remains empty. Any sugestions?

Insert Into [Data Units TW Inuvik] (SType, Owner, Area, Unit)
SELECT [Data Units].Stype, [Data Units].Owner, [Table Owner].Area, [Data
Units].Unit
FROM [Table Owner] INNER JOIN [Data Units] ON [Table Owner].Owner = [Data
Units].Owner
WHERE ((([Data Units].InDate)<=#8/31/2004#) AND (([Data
Units].TmDate)>=#8/31/2004# Or ([Data Units].TmDate) Is Null) AND
(([Table
Owner].Area)="Inuvik") AND (([Data Units].Unit)>=8677770000 And ([Data
Units].Unit)<=8677779999) AND (([Data Units].Template)<>"PRPD")) OR

((([Data
Units].InDate)<=#8/31/2004#) AND (([Data Units].TmDate)>=#8/31/2004# Or
([Data Units].TmDate) Is Null) AND (([Table Owner].Area)="Inuvik") AND
(([Data Units].Unit)>=8676780000 And ([Data Units].Unit)<=8676789999) AND
(([Data Units].Template)<>"PRPD"))
GROUP BY [Data Units].Stype, [Table Owner].Area, [Data Units].Owner,

[Data
Units].Unit
ORDER BY [Data Units].Stype;


Nov 13 '05 #4
Based on what you've posted, I am not sure what may be wrong.

You say the SELECT portion of the query is working (leaving off the INSERT
INTO portion). With this info, I would assume that some type of integrity
(duplicate primary key, duplicate unique key values, etc.) is being violated
by your attempt to insert the new records.

Do you have SetWarnings turned off in your database, and thus ACCESS is not
telling you that there is an error?
--

Ken Snell
<MS ACCESS MVP>
"efgh" <ef**@neverland.com> wrote in message
news:Dl********************@nnrp1.uunet.ca...
I'm trying to run it from from the database window.

"Ken Snell" <kt***********@ncoomcastt.renaetl> wrote in message
news:a6********************@comcast.com...
How are you running this query? By opening the query from database window? From VBA code or macro? Post more details about your process.

--

Ken Snell
<MS ACCESS MVP>

"efgh" <ef**@neverland.com> wrote in message
news:so********************@nnrp1.uunet.ca...
I'm fairly confident in my knowledge of SQL but I'm stumped with regards with an Insert Into statement in Access 2003. I've got a 4 column table that I've simplified about as much as I can, no primary key, no
indexes(at
least I don't think I have any), allow duplicates, allow zero length

fields,
the fields in the new table are of the same type of the fields in the old table, etc. Maybe someone can give me an idea as to what I'm doing
wrong.
MS Access I've noticed doesn't give me any error messages to tell me what I'm doing wrong. The only way I can tell it's not working is by checking the table and seeing it's still empty.
When I run the Select statement by itself, it's returns what I want but

for
some reason, my table still remains empty. Any sugestions?

Insert Into [Data Units TW Inuvik] (SType, Owner, Area, Unit)
SELECT [Data Units].Stype, [Data Units].Owner, [Table Owner].Area, [Data Units].Unit
FROM [Table Owner] INNER JOIN [Data Units] ON [Table Owner].Owner = [Data Units].Owner
WHERE ((([Data Units].InDate)<=#8/31/2004#) AND (([Data
Units].TmDate)>=#8/31/2004# Or ([Data Units].TmDate) Is Null) AND
(([Table
Owner].Area)="Inuvik") AND (([Data Units].Unit)>=8677770000 And ([Data
Units].Unit)<=8677779999) AND (([Data Units].Template)<>"PRPD")) OR

((([Data
Units].InDate)<=#8/31/2004#) AND (([Data Units].TmDate)>=#8/31/2004# Or
([Data Units].TmDate) Is Null) AND (([Table Owner].Area)="Inuvik") AND
(([Data Units].Unit)>=8676780000 And ([Data Units].Unit)<=8676789999) AND (([Data Units].Template)<>"PRPD"))
GROUP BY [Data Units].Stype, [Table Owner].Area, [Data Units].Owner,

[Data
Units].Unit
ORDER BY [Data Units].Stype;



Nov 13 '05 #5
I figured out what I was doing wrong. I was right clicking on the title bar
of the SQL window and choosing Datasheet View. Since I was seeing the
results of the query, I thought it was working, only to find out it wasn't
when I looked at the table. I didn't realize that in order to actually run
the query, you have to close it or save it, then go to the Database Window
and "Open" it from there. Thanks for the help though.
"Ken Snell" <kt***********@ncoomcastt.renaetl> wrote in message
news:87********************@comcast.com...
Based on what you've posted, I am not sure what may be wrong.

You say the SELECT portion of the query is working (leaving off the INSERT
INTO portion). With this info, I would assume that some type of integrity
(duplicate primary key, duplicate unique key values, etc.) is being
violated
by your attempt to insert the new records.

Do you have SetWarnings turned off in your database, and thus ACCESS is
not
telling you that there is an error?
--

Ken Snell
<MS ACCESS MVP>
"efgh" <ef**@neverland.com> wrote in message
news:Dl********************@nnrp1.uunet.ca...
I'm trying to run it from from the database window.

"Ken Snell" <kt***********@ncoomcastt.renaetl> wrote in message
news:a6********************@comcast.com...
> How are you running this query? By opening the query from database window? > From VBA code or macro? Post more details about your process.
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
>
> "efgh" <ef**@neverland.com> wrote in message
> news:so********************@nnrp1.uunet.ca...
>> I'm fairly confident in my knowledge of SQL but I'm stumped with regards >> with an Insert Into statement in Access 2003. I've got a 4 column table >> that I've simplified about as much as I can, no primary key, no
>> indexes(at
>> least I don't think I have any), allow duplicates, allow zero length
> fields,
>> the fields in the new table are of the same type of the fields in the old >> table, etc. Maybe someone can give me an idea as to what I'm doing
>> wrong.
>> MS Access I've noticed doesn't give me any error messages to tell me what >> I'm doing wrong. The only way I can tell it's not working is by checking >> the table and seeing it's still empty.
>> When I run the Select statement by itself, it's returns what I want
>> but
> for
>> some reason, my table still remains empty. Any sugestions?
>>
>> Insert Into [Data Units TW Inuvik] (SType, Owner, Area, Unit)
>> SELECT [Data Units].Stype, [Data Units].Owner, [Table Owner].Area, [Data >> Units].Unit
>> FROM [Table Owner] INNER JOIN [Data Units] ON [Table Owner].Owner = [Data >> Units].Owner
>> WHERE ((([Data Units].InDate)<=#8/31/2004#) AND (([Data
>> Units].TmDate)>=#8/31/2004# Or ([Data Units].TmDate) Is Null) AND
>> (([Table
>> Owner].Area)="Inuvik") AND (([Data Units].Unit)>=8677770000 And ([Data
>> Units].Unit)<=8677779999) AND (([Data Units].Template)<>"PRPD")) OR
> ((([Data
>> Units].InDate)<=#8/31/2004#) AND (([Data Units].TmDate)>=#8/31/2004#
>> Or
>> ([Data Units].TmDate) Is Null) AND (([Table Owner].Area)="Inuvik") AND
>> (([Data Units].Unit)>=8676780000 And ([Data Units].Unit)<=8676789999) AND >> (([Data Units].Template)<>"PRPD"))
>> GROUP BY [Data Units].Stype, [Table Owner].Area, [Data Units].Owner,
> [Data
>> Units].Unit
>> ORDER BY [Data Units].Stype;
>>
>>
>
>



Nov 13 '05 #6
You can run the action query from the design view...click on the red
exclamation point in the center of the toolbar.
--

Ken Snell
<MS ACCESS MVP>

"efgh" <ef**@neverland.com> wrote in message
news:Bc********************@nnrp1.uunet.ca...
I figured out what I was doing wrong. I was right clicking on the title bar of the SQL window and choosing Datasheet View. Since I was seeing the
results of the query, I thought it was working, only to find out it wasn't
when I looked at the table. I didn't realize that in order to actually run the query, you have to close it or save it, then go to the Database Window
and "Open" it from there. Thanks for the help though.
"Ken Snell" <kt***********@ncoomcastt.renaetl> wrote in message
news:87********************@comcast.com...
Based on what you've posted, I am not sure what may be wrong.

You say the SELECT portion of the query is working (leaving off the INSERT INTO portion). With this info, I would assume that some type of integrity (duplicate primary key, duplicate unique key values, etc.) is being
violated
by your attempt to insert the new records.

Do you have SetWarnings turned off in your database, and thus ACCESS is
not
telling you that there is an error?
--

Ken Snell
<MS ACCESS MVP>
"efgh" <ef**@neverland.com> wrote in message
news:Dl********************@nnrp1.uunet.ca...
I'm trying to run it from from the database window.

"Ken Snell" <kt***********@ncoomcastt.renaetl> wrote in message
news:a6********************@comcast.com...
> How are you running this query? By opening the query from database

window?
> From VBA code or macro? Post more details about your process.
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
>
> "efgh" <ef**@neverland.com> wrote in message
> news:so********************@nnrp1.uunet.ca...
>> I'm fairly confident in my knowledge of SQL but I'm stumped with

regards
>> with an Insert Into statement in Access 2003. I've got a 4 column

table
>> that I've simplified about as much as I can, no primary key, no
>> indexes(at
>> least I don't think I have any), allow duplicates, allow zero length
> fields,
>> the fields in the new table are of the same type of the fields in the
old
>> table, etc. Maybe someone can give me an idea as to what I'm doing
>> wrong.
>> MS Access I've noticed doesn't give me any error messages to tell me

what
>> I'm doing wrong. The only way I can tell it's not working is by

checking
>> the table and seeing it's still empty.
>> When I run the Select statement by itself, it's returns what I want
>> but
> for
>> some reason, my table still remains empty. Any sugestions?
>>
>> Insert Into [Data Units TW Inuvik] (SType, Owner, Area, Unit)
>> SELECT [Data Units].Stype, [Data Units].Owner, [Table Owner].Area,

[Data
>> Units].Unit
>> FROM [Table Owner] INNER JOIN [Data Units] ON [Table Owner].Owner =

[Data
>> Units].Owner
>> WHERE ((([Data Units].InDate)<=#8/31/2004#) AND (([Data
>> Units].TmDate)>=#8/31/2004# Or ([Data Units].TmDate) Is Null) AND
>> (([Table
>> Owner].Area)="Inuvik") AND (([Data Units].Unit)>=8677770000 And
([Data >> Units].Unit)<=8677779999) AND (([Data Units].Template)<>"PRPD")) OR
> ((([Data
>> Units].InDate)<=#8/31/2004#) AND (([Data Units].TmDate)>=#8/31/2004#
>> Or
>> ([Data Units].TmDate) Is Null) AND (([Table Owner].Area)="Inuvik") AND >> (([Data Units].Unit)>=8676780000 And ([Data

Units].Unit)<=8676789999) AND
>> (([Data Units].Template)<>"PRPD"))
>> GROUP BY [Data Units].Stype, [Table Owner].Area, [Data Units].Owner,
> [Data
>> Units].Unit
>> ORDER BY [Data Units].Stype;
>>
>>
>
>



Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great...
14
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
4
by: Chris Kratz | last post by:
Hello all, We have run into what appears to be a problem with rules and subselects in postgres 7.4.1. We have boiled it down to the following test case. If anyone has any thoughts as to why...
2
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request :...
3
by: MP | last post by:
Hi Posted this several hours ago to another ng but it never showed up thought i'd try here. using vb6, ado, .mdb, jet4.0, no access given table tblJob with field JobNumber text(10) 'The...
6
by: lenygold via DBMonster.com | last post by:
Hi everybody: What is the best way to I have 10 tables with similar INSERT requiremnts. INSERT INTO ACSB.VAATAFAE WITH AA(AA_TIN, AA_FILE_SOURCE_CD, .AA_TIN_TYP) AS ( SELECT AA_TIN,...
24
by: Henry J. | last post by:
My app needs to insert thousand value rows into a mostly empty table (data are read from a file). I can either use inserts, or use merge. The advantage of using merge is that in the few cases...
1
by: Mike1961 | last post by:
Hi all. I have problem with this asp code: strSplitDati = Split(request.Form("dati"), ",") for i = LBound(strSplitDati) to (INT(UBound(strSplitDati)/4)-1)*4 step 4 ...
1
by: EJO | last post by:
with sql 2000 enterprise Trying to build a stored procedure that will take the rows of a parent table, insert them into another table as well as the rows from a child table to insert into...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.