Insert Into query statement error between tables within same DB,Up

  • Thread starter Thread starter BeSam
  • Start date Start date
B

BeSam

Use following in a query to run, get syntax error for Insert Into statement:

INSERT INTO Kopia av Kontakter [(Efternamn[, Förnamn[, Företag[, Kategori[,
Språk[, E-postadress[, Telefon-arbete[, Telefon2[, Faxnummer[, Mobiltelefon[,
Telefon-hem[, Godk epost reklam]]]]]]]]]]])]
SELECT [Reinholds-Kontakter-Test].Efternamn,
[Reinholds-Kontakter-Test].Förnamn, [Reinholds-Kontakter-Test].Företag,
[Reinholds-Kontakter-Test].Kategori, [Reinholds-Kontakter-Test].Språk,
[Reinholds-Kontakter-Test].[E-postadress],
[Reinholds-Kontakter-Test].[Telefon-arbete],
[Reinholds-Kontakter-Test].Telefon2, [Reinholds-Kontakter-Test].Faxnummer,
[Reinholds-Kontakter-Test].Mobiltelefon,
[Reinholds-Kontakter-Test].[Telefon-hem], [Reinholds-Kontakter-Test].[Godk
epost reklam]
FROM [Reinholds-Kontakter-Test] LEFT JOIN Kontakter ON
[Reinholds-Kontakter-Test].[E-postadress]=Kontakter.[E-postadress]
WHERE (((Kontakter.[E-postadress]) Is Null));


Also if wish update same table for present columns and/or with new columns
would also be appretiated commented!


Kind regards for help,
Bengt S
 
Hi Bengt,
INSERT INTO Kopia av Kontakter

The above is going to need square brackets around the table name, since it
includes special characters (spaces). Use this instead:

INSERT INTO [Kopia av Kontakter]

Better yet, avoid the use of any special characters or reserved words for
things that you assign a name to within Access:

Special characters that you must avoid when you work with Access databases
http://support.microsoft.com/?id=826763

Problem names and reserved words in Access
http://allenbrowne.com/AppIssueBadWord.html
[(Efternamn[, Förnamn[, Företag[, Kategori[,

This is wrong too. You need square brackets surrounding each field name, but
only if there are special characters or reserved words involved. I think we'd
better assume that the umlaut is a special character. Use this instead:

([Efternamn] , [Förnamn], [Företag], [Kategori], ...

Note in the above how the opening parentheses comes before the opening
square bracket surrounding the field name.
Telefon-hem[, Godk epost reklam]]]]]]]]]]])]

Nope. You cannot treat square brackets like parentheses. As shown above,
they need to delimit each field name individually.

Try something like this:

INSERT INTO [Kopia av Kontakter]
([Efternamn] , [Förnamn], [Företag], [Kategori], [Språk],
[E-postadress], [Telefon-arbete], [Telefon2], [Faxnummer], [Mobiltelefon],
[Telefon-hem], [Godk epost reklam])

SELECT
[Reinholds-Kontakter-Test].Efternamn,
[Reinholds-Kontakter-Test].[Förnamn], [Reinholds-Kontakter-Test].[Företag],
[Reinholds-Kontakter-Test].Kategori, [Reinholds-Kontakter-Test].[Språk],
[Reinholds-Kontakter-Test].[E-postadress],
[Reinholds-Kontakter-Test].[Telefon-arbete],
[Reinholds-Kontakter-Test].Telefon2,
[Reinholds-Kontakter-Test].Faxnummer,
[Reinholds-Kontakter-Test].Mobiltelefon,
[Reinholds-Kontakter-Test].[Telefon-hem],
[Reinholds-Kontakter-Test].[Godkepost reklam]

FROM [Reinholds-Kontakter-Test]
LEFT JOIN Kontakter
ON [Reinholds-Kontakter-Test].[E-postadress]=Kontakter.[E-postadress]
WHERE Kontakter.[E-postadress] Is Null;



Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________

BeSam said:
Use following in a query to run, get syntax error for Insert Into statement:

INSERT INTO Kopia av Kontakter [(Efternamn[, Förnamn[, Företag[, Kategori[,
Språk[, E-postadress[, Telefon-arbete[, Telefon2[, Faxnummer[, Mobiltelefon[,
Telefon-hem[, Godk epost reklam]]]]]]]]]]])]
SELECT [Reinholds-Kontakter-Test].Efternamn,
[Reinholds-Kontakter-Test].Förnamn, [Reinholds-Kontakter-Test].Företag,
[Reinholds-Kontakter-Test].Kategori, [Reinholds-Kontakter-Test].Språk,
[Reinholds-Kontakter-Test].[E-postadress],
[Reinholds-Kontakter-Test].[Telefon-arbete],
[Reinholds-Kontakter-Test].Telefon2, [Reinholds-Kontakter-Test].Faxnummer,
[Reinholds-Kontakter-Test].Mobiltelefon,
[Reinholds-Kontakter-Test].[Telefon-hem], [Reinholds-Kontakter-Test].[Godk
epost reklam]
FROM [Reinholds-Kontakter-Test] LEFT JOIN Kontakter ON
[Reinholds-Kontakter-Test].[E-postadress]=Kontakter.[E-postadress]
WHERE (((Kontakter.[E-postadress]) Is Null));


Also if wish update same table for present columns and/or with new columns
would also be appretiated commented!


Kind regards for help,
Bengt S
 
Back
Top