First error that you get: "now I'm getting 'you are about to append two
records (which is correct), but then is says 0 records have been appended
due to key violations - have searched in all sorts of places to understand
what this means, but cannot figure it out."
This error means that you're trying to add a record that has the same
primary key value as a record that already exists in the target table. Based
on your joining field, I assume that Case No is the primary key field in the
target table, and if so, then I am puzzled that you would get this error --
unless Case No is Null in the records that you're trying to append? Provide
more info about the fields and the primary key setup.....
Oh wait.... see the last field in your list of fields just before the FROM
clause:
[Lead details].[Case No]
You're trying to use the Case No of the joined record (which will be Null)
as the value of Case No that is to be put into the target table -- and this
accounts for the key violations. I believe this should be
[full exporttemp].[Case No]
Second error: "because it kept saying 'Microsoft access can't match the
fields you added using the asterix in the append query' and changing the
name of the append to field back to lead details append query*next time I
went in"
I wasn't able to test your actual SQL statement, but I wasn't sure that you
would be successful using the asterisk. As you've correctly noted in your
SQL that lists all the fields in the target table, you must list the fields,
not an *.
--
Ken Snell
<MS ACCESS MVP>
Mattymoo said:
So near but so far - corrected the typo and also appended field by
field
so I have this
INSERT INTO [Lead details] ( Client_Name, [Date Lead Received], [Date
of
Birth], Email, Postcode, [Loan Amount Required], Valuation, Term, Telephone,
[Best Time], [Time of Day], [Supporting Information], Status, [Client
Contacted], [Appointment Date], [Follow Up Date], [Anticipated Completion],
[Advise On], Comments, [Appointment Booked], [Mortgage fee], [Mortgage
value], [Mortgage date], [LC fee], [LC value], [LC date], [ASU fee], [ASU
value], [ASU date], [BC fee], [BC value], [BC date], [Broker fee], [Broker
value], [Broker date], [other fee], [other value], [other date], [Case No] )
SELECT [full exporttemp].Client_Name, [full exporttemp].[Date Lead
Received], [full exporttemp].[Date of Birth], [full exporttemp].Email, [full
exporttemp].Postcode, [full exporttemp].[Loan Amount Required], [full
exporttemp].Valuation, [full exporttemp].Term, [full exporttemp].Telephone,
[full exporttemp].[Best Time], [full exporttemp].[Time of Day], [full
exporttemp].[Supporting Information], [full exporttemp].Status, [full
exporttemp].[Client Contacted], [full exporttemp].[Appointment Date], [full
exporttemp].[Follow Up Date], [full exporttemp].[Anticipated Completion],
[full exporttemp].[Advise On], [full exporttemp].Comments, [full
exporttemp].[Appointment Booked], [full exporttemp].[Mortgage fee], [full
exporttemp].[Mortgage value], [full exporttemp].[Mortgage date], [full
exporttemp].[LC fee], [full exporttemp].[LC value], [full exporttemp].[LC
date], [full exporttemp].[ASU fee], [full exporttemp].[ASU value], [full
exporttemp].[ASU date], [full exporttemp].[BC fee], [full exporttemp].[BC
value], [full exporttemp].[BC date], [full exporttemp].[Broker fee], [full
exporttemp].[Broker value], [full exporttemp].[Broker date], [full
exporttemp].[other fee], [full exporttemp].[other value], [full
exporttemp].[other date], [Lead details].[Case No]
FROM [full exporttemp] LEFT JOIN [Lead details] ON [full
exporttemp].[Case
No] = [Lead details].[Case No]
WHERE ((([Lead details].[Case No]) Is Null));
now I'm getting 'you are about to append two records (which is
correct),
but then is says 0 records have been appended due to key violations - have
searched in all sorts of places to understand what this means, but cannot
figure it out.
I couldn't leave as it was, because it kept saying 'Microsoft access
can't
match the fields you added using the asterix in the append query' and
changing the name of the append to field back to lead details append
query*next time I went in
I then tried a different approach and copy your code across and the
error
I get when I switch to design view is 'Syntax error in join operation'
Sorry I'm such a nightmare - I'm sure once I fix it all will become
clear
as to what the problem is
:
Typo again? You have
Lead details append query
as the target table (the table to get the appended records), but I believe
it should be
Lead details
INSERT INTO [Lead details]
SELECT [full exporttemp].*
FROM [full exporttemp] LEFT JOIN [Lead details] ON [full
exporttemp].[Case No] = [Lead details].[Case No]
WHERE ((([Lead details].[Case No]) Is Null));
--
Ken Snell
<MS ACCESS MVP>
I saw it, corrected it and a couple of other minor orrors and it's working
just fine thanks.
My append query is not though - it says 'Cannot insert data with action
query query'.
The sql view is as below. Can you tell what's wrong here
Thanks for your continued help
Pauline
:
Now that I'm more awake, do you see the same typo in your query
that
I
see:
Initially, you use this as the name of the temporary table:
full exporttemp
Later, you use this:
fullexporttemp
I'm guessing that the second one is wrong, and that is why the
query
is
asking for the parameter values for each field.
--
Ken Snell
<MS ACCESS MVP>
Yes the temp fields are all text fomratted and I'm asked to provide
parameters on all 39 fields (now I've corrected a couple of errors I
spotted)
If I ok the parameter request without entering any data. I
get
the
following error.
Microsoft access can't update all the records in the update query:
MAS didn't update 0 fields due to a type conversion failure, 14
records
due to key violations and 0 records due to record violations.
To
ignore
click yes etc.
:
I do not see anything obviously wrong with your queries. You note
that
the
temporary table's fields all are text formatted. Are the permanent
table's
fields also text formatted?
Which specific parameters are you asked to provide when you
run
the
update
query?
--
Ken Snell
<MS ACCESS MVP>
The name of the temporary file is fullexporttemp and has the
following
fields
Case No (primary field as this is a urn)
Client_Name
Date Lead Received
Date of Birth
Email
Postcode
Loan Amount Required
Valuation
Term
Telephone
Best Time
Time of Day
Supporting Information
Status
Client Contacted
Appointment Date
Follow Up Date
Anticipated Completion
Advise On
Comments
Appointment Booked
Mortgage fee
Mortgage value
Mortgage date
LC fee
LC value
LC date
ASU fee
ASU value
ASU date
BC fee
BC value
BC date
Broker fee
Broker value
Broker date
other fee
other value
other date
These fields mirror the excel spreadsheet exactly, but the data
types
in
access are all set to text otherwise I couldn't import the table.
The permanent table id called 'lead details' and currently has
exactly
the
same fields (I need to add more as I will use this table to extract
cases
for QC purposes and record the results, but I wanted to get the
import/
update process right before I added more fields)
THis is SQL view od the update query
UPDATE [Lead details] INNER JOIN [full exporttemp] ON [Lead
details].[Case
No] = [full exporttemp].[Case No] SET [Lead details].[Case No] =
fullexporttemp.[Case No], [Lead details].Client_Name =
fullexporttemp.Client_Name, [Lead details].[Date Lead
Received]
=
fullexporttemp.[Date Lead Received], [Lead details].[Date of Birth]
=
fullexporttemp.[Date of Birth], [Lead details].Email =
fullexporttemp.Email,
[Lead details].Postcode = fullexporttemp.Postcode, [Lead
details].[Loan
Amount Required] = fullexporttemp.[Loan Amount Required], [Lead
details].Valuation = fullexporttemp.Valuation, [Lead details].Term =
fullexporttemp.Term, [Lead details].Telephone =
fullexporttemp.Telephone,
[Lead details].[Best Time] = fullexporttemp.[Best Time], [Lead
details].[Time of Day] = fullexporttemp.[Time of Day], [Lead
details].[Supporting Information] = fullexporttemp.[Supporting
Information],
[Lead details].Status = fullexporttemp.Status, [Lead
details].[Client
Contacted] = fullexporttemp.[Client Contacted], [Lead
details].[Appointment
Date] = fullexporttemp.[Appointment Date], [Lead details].[Follow Up
Date] =
fullexporttemp.[Follow Up Date], [Lead details].[Anticipated
Completion]
=
fullexporttemp.[Anticipated Completion], [Lead
details].Comments
=
fullexport.fullexporttemp, [Lead details].[Appointment Booked] =
fullexporttemp.[Appointment Booked], [Lead
details].[Mortgage
fee] =
fullexporttemp.[Mortgage fee], [Lead details].[Mortgage value] =
fullexporttemp.[Mortgage value], [Lead details].[Mortgage
date]
=
fullexporttemp.[Mortgage date], [Lead details].[LC fee] =
fullexporttemp.[LC
fee], [Lead details].[LC value] = fullexporttemp.[Lead details],
[Lead
details].[LC date] = fullexporttemp.[Lead details], [Lead
details].[ASU
fee]
= fullexporttemp.[ASU fee], [Lead details].[ASU value] =
fullexporttemp.[ASU
value], [Lead details].[ASU date] = fullexporttemp.[ASU
date],
[Lead
details].[BC fee] = fullexporttemp.[BC fee], [Lead details].[BC
value] =
fullexporttemp.[BC value], [Lead details].[BC date] =
fullexporttemp.[BC
date], [Lead details].[Broker fee] = fullexporttemp.[Broker fee],
[Lead
details].[Broker value] = "f[fullexporttemp].[Broker
value]",
[Lead
details].[Broker date] = fullexporttemp.[Broker date], [Lead
details].[other
fee] = fullexporttemp.[other fee], [Lead details].[other
value]
=
fullexporttemp.[other value], [Lead details].[other date] =
fullexporttemp.[other date];
And this is the SQL view of the append query
INSERT INTO [Lead details append query]
SELECT [full exporttemp].*
FROM [full exporttemp] LEFT JOIN [Lead details] ON [full
exporttemp].[Case
No] = [Lead details].[Case No]
WHERE ((([Lead details].[Case No]) Is Null));
There are only 14 records in my excel spreadsheet at the moment
and
they
are all in my perm 'lead details' table. I changed some of the
details
and
added two new records before importing into the temp
'fullexporttemp'
and
that file looks correct
I've just looked at the update query in datasheet view and noticed
that it
has the orginal 14 records before they were changed, but not
the
two
new
ones.
The append query file has only the two new records in it,
but
none
of
the
original ones.
Hope this makes sense to you? there's a lot of info here
Thanks for your patience
Pauline