Appendquery to add display record, only

  • Thread starter Thread starter an
  • Start date Start date
A

an

Hello!

I have an Appendquery wich append all records to T_Values.
But I would like append present record only, because is
unique record with new data.
I need help to do this.
Thanks in advance.
an
 
Hi,


Someone can always append a record in another table without opening a
recordset, with a statement like:


CurrentDb.Execute "INSERT INTO otherTableName(ListOfFields)
VALUES(ListOfValues) ", dbFailOnError



The list of values should contain the proper delimiters, if required. As
example, if f2 is alphanumerical:

CurrentDb.Execute "INSERT INTO mTable1(f1, f2, f3) VALUES(1010, 'a',
3.141592) ", dbFailOnError




will insert a record in mTable1 with values 1010, the literal a, and pi
value (approx), in fields f1, f2 and f3, respectively.



Hoping it may help,
Vanderghast, Access MVP
 
Thanks for your reply.
I don't know if your solution may be to applicate for my
problem, unfortunately.
I have fields with Date/Time, numeric and alphanumeric
values. They are from Q_Query and go to T_Values with all
fields of the Q_Query.
When I have a new data, I update it and (I would like) I
save only new data on that record in T _Values.
Apparently is possible but I don't know how.
Thanks.an
 
Hi,



INSERT INTO ... VALUES add one record,

INSERT INTO ... SELECT add many records (the records "SELECTed").


It the "actual record" has for its pk the value 1010, as example, then

INSERT INTO otherTable( ListOfFields) SELECT (ListOfFields2) FROM
originalTable WHERE pk=1010


would append the unique record from originalTable that has its pk value =
1010.


If you wish, ***but I don't suggest it***, you can use List-less syntax:

INSERT INTO otherTable SELECT * FROM originalTable WHERE pk=1010



Hoping it may help,
Vanderghast, Access MVP
 
Ok, I understand but already I have one condition in
Appendquery Criteria (alphanumeric data: Local).
Now, I need to ordenate which IdLocal number in order
assumed for "actual record", whithout to be necessary to
write it.
I think which is possible to define it in design
Appendquery but I don't know how.
I try to define it in design Appendquery, on IdLocal
column, but I don't know necessary code.

Thank you.
an
 
Back
Top