append query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
I would like to be able to append to a new tbl_history records from 2 tables
in which the [loan acct #] exist in both tables AND the [status] is NOT the
same in both tables for that [loan acct #]

HOW?

thanks in advance,
geebee
 
Assumptions:
NewTable exists
Status fields are not null in the TableA or TableB

INSERT Into NewTable ([Loan Acct#]
SELECT TableA.[Loan Acct#]
FROM TableA INNER JOIN TableB
ON TableA.[Loan Acct#] = TableB.[Loan Acct#]
WHERE TableA.Status <> TableB.Status
 
i put the query as you stated in a query (SQL view). I also amended it to
the following:

INSERT Into tbl_history([Loan Acct#])
SELECT tbl_masterpop.[Loan Acct#]
FROM tbl_masterpop INNER JOIN tbl_masterpop_new
ON tbl_masterpop.[Loan Acct#] = tbl_masterpop_new.[Loan Acct#]
WHERE tbl_masterpop.Status <> tbl_masterpop_new.Status);

but i am getting a syntax error. I would like for this to be done using a
button on a form. so how would this change the syntax., or how would the
syntax be for the code behind a form button to perform this?

thanks in advance,
geebee


John Spencer said:
Assumptions:
NewTable exists
Status fields are not null in the TableA or TableB

INSERT Into NewTable ([Loan Acct#]
SELECT TableA.[Loan Acct#]
FROM TableA INNER JOIN TableB
ON TableA.[Loan Acct#] = TableB.[Loan Acct#]
WHERE TableA.Status <> TableB.Status


geebee said:
hi,
I would like to be able to append to a new tbl_history records from 2
tables
in which the [loan acct #] exist in both tables AND the [status] is NOT
the
same in both tables for that [loan acct #]

HOW?

thanks in advance,
geebee
 
You are missing a space between tbl_History and ([Loan Acct#])

Sorry, I can't respond further at this point. I will try to get back to
this later. If you get the query running, you might post a new question in
the forms coding group.


geebee said:
i put the query as you stated in a query (SQL view). I also amended it to
the following:

INSERT Into tbl_history([Loan Acct#])
SELECT tbl_masterpop.[Loan Acct#]
FROM tbl_masterpop INNER JOIN tbl_masterpop_new
ON tbl_masterpop.[Loan Acct#] = tbl_masterpop_new.[Loan Acct#]
WHERE tbl_masterpop.Status <> tbl_masterpop_new.Status);

but i am getting a syntax error. I would like for this to be done using a
button on a form. so how would this change the syntax., or how would the
syntax be for the code behind a form button to perform this?

thanks in advance,
geebee


John Spencer said:
Assumptions:
NewTable exists
Status fields are not null in the TableA or TableB

INSERT Into NewTable ([Loan Acct#]
SELECT TableA.[Loan Acct#]
FROM TableA INNER JOIN TableB
ON TableA.[Loan Acct#] = TableB.[Loan Acct#]
WHERE TableA.Status <> TableB.Status


geebee said:
hi,
I would like to be able to append to a new tbl_history records from 2
tables
in which the [loan acct #] exist in both tables AND the [status] is NOT
the
same in both tables for that [loan acct #]

HOW?

thanks in advance,
geebee
 

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

append only if [status] is different 3
query not acting right 5
DUPLICATE QUERY results 1
make union query into make-table query 2
query error 1
query problems 5
query differences 1
conditional criteria 4

Back
Top