Mail Merge

A

Amour

Hi I am new to access and was hoping someone could help me.

I am getting this message:

The INSERT INTO statement contains the following unknown field name: 'CELL''
Make sure you have typed the name correctly, and try the operation again.
Error 3127)

when I run this:

maketablestring = " INSERT INTO tblTempBTO IN '" & tmpLetterDB & "' " _
& " SELECT tblPersonnel.*, StrConv([FIRST_NAME],3) AS lcfirst,
StrConv([LAST_NAME],3) AS lclast, StrConv([addr1],3) AS lcaddr1,
StrConv([addr2],3) AS lcaddr2, StrConv([city],3) AS lccity,
StrConv([state],3) AS lcstate, StrConv([zip],3) AS lczip,
StrConv([company],3) AS lccompany, StrConv([title],3) AS lctitle" _
& " FROM tblPersonnel "
If qrystring <> "" Then
maketablestring = maketablestring & " where " & qrystring & "
order by last_name"
End If
dbLocal.Execute (maketablestring)

maketablestring is where I am getting it but I can not find anything that
says:

CELL

So I did some changing where the ("' " & " Select) is in the statement
yet I get different error's.

I tried:

Debug.Print maketablestring

and got this in the window:

INSERT INTO tblTempBTO IN 'c:\asb6\datafiles\letterfile03.mdb' SELECT
tblPersonnel.*, StrConv([first_name],3) AS lcfirst, StrConv([LAST_NAME],3) AS
lclast, StrConv([addr1],3) AS lcaddr1, StrConv([addr2],3) AS lcaddr2,
StrConv([city],3) AS lccity, StrConv([state],3) AS lcstate, StrConv([zip],3)
AS lczip, StrConv([company],3) AS lccompany, StrConv([title],3) AS lctitle
FROM tblPersonnel where [SSN] like '999-99-9999' order by last_name


What am I doing wrong. I know that it may be storing data redundantly in
the new table, but this is the way the old system was written and I am just
trying to fix the problem for now. Later I would like to change the whole
program.

Maybe if I put the table: tblTempBTO within the same database that is
actively running and not use: 'c:\asb6\datafiles\letterfile03.mdb' But I
would need to know how to write that SQL Statement.


Please help

Thank You!
 
W

Wolfgang Kais

Hello Amour.

:
Hello Amour.

Amour said:
Hi I am new to access and was hoping someone could help me.

I am getting this message:

The INSERT INTO statement contains the following unknown field
name: 'CELL'' Make sure you have typed the name correctly, and
try the operation again. Error 3127)

when I run this:

maketablestring = " INSERT INTO tblTempBTO IN '" & tmpLetterDB &
"' SELECT tblPersonnel.*, StrConv([FIRST_NAME],3) AS lcfirst,
StrConv([LAST_NAME],3) AS lclast, StrConv([addr1],3) AS lcaddr1,
StrConv([addr2],3) AS lcaddr2, StrConv([city],3) AS lccity,
StrConv([state],3) AS lcstate, StrConv([zip],3) AS lczip,
StrConv([company],3) AS lccompany, StrConv([title],3) AS lctitle" _
& " FROM tblPersonnel "
If qrystring <> "" Then
maketablestring = maketablestring & " where " & qrystring &
" order by last_name"
End If
dbLocal.Execute (maketablestring)

maketablestring is where I am getting it but I can not find anything
that says:

CELL

So I did some changing where the ("' " & " Select) is in the
statement yet I get different errors.

I tried:

Debug.Print maketablestring

and got this in the window:

INSERT INTO tblTempBTO IN 'c:\asb6\datafiles\letterfile03.mdb'
SELECT tblPersonnel.*, StrConv([first_name],3) AS lcfirst,
StrConv([LAST_NAME],3) AS lclast, StrConv([addr1],3) AS lcaddr1,
StrConv([addr2],3) AS lcaddr2, StrConv([city],3) AS lccity,
StrConv([state],3) AS lcstate, StrConv([zip],3) AS lczip,
StrConv([company],3) AS lccompany, StrConv([title],3) AS lctitle
FROM tblPersonnel where [SSN] like '999-99-9999' order by last_name


What am I doing wrong. I know that it may be storing data redundantly
in the new table, but this is the way the old system was written and
I am just trying to fix the problem for now. Later I would like to
change the whole program.

Maybe if I put the table: tblTempBTO within the same database that
is actively running and not use: 'c:\asb6\datafiles\letterfile03.mdb'
But I would need to know how to write that SQL Statement.

Your query is an append query, and I guess that tblPersonnel contains
a column name that is missing in tblTempBTO.
A make table table query would look like this:
SELECT ... INTO tblTempBTO IN 'c:\...' FROM ... WHERE ... ORDER BY ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Run-Time Error 3127 2
Error Message 3127 3
join 0
Mail Merge Problem 5
Problem with mail merge 2
Conditional Mail Merge won't suppress blank lines 2
Unknown name in mail merge 2
Mail merge manager 1

Top