Hi
I wish to append a new record to a separate table (before clearing the field
contents for re-entry) using a command box. There are no other unique fields
(the record entry form is a subform).
Ie: Append new record in [TableA] to [TableB] using [MyID] (autonumber in
[TableA]) to determine whether the current record is already in [TableB].
Per recommendation (appended below after this msg), the query runs perfectly.
Unfortunately however, [MyID] in [TableA] is an autonumber, and I believe it
is causing me to get the error message:
"Data type mismatch in criteria expression".
None of my cells are Null. Is there something I can do to make the query
read MyID not as an autonumber?
Is this the issue here? Is there a more efficient means of performing this?
Thanks in advance
Will
PS I have yet to go on VBA courses so please be gentle.
"Ken Sheridan" wrote:
> You'll need to run ... an append query to insert the new rows. ...For the sake of this example I'll assume a single column non-autonumber key called MyID, so the query would go like this:
> To append new rows from table A to table B you need to identify those rows
> in Table B which don't exist in Table B:
>
> INSERT INTO [Table B]
> ([MyID], [Field1], [Field2], [Field 3],[Field 4])
> SELECT [MyID], [Field1], [Field2], [Field 3],[Field 4]
> FROM [Table A]
> WHERE NOT EXISTS
> (SELECT *
> FROM [Table B]
> WHERE [TableB].[MyID] = [TableA].[MyID];
|
|
0
|
|
|
|
Reply
|
Utf
|
5/16/2007 8:38:01 AM |
|
Will,
The query below is missing a closing parenthesis. Does your query have that?
Is the [MyID] field in table B a long integer, that is how Autonumber fields
are defined? If not, change it and try your query again. It cannot be an
Autonumber field in Table B!
You might also want to check the parameters of the fields you are importing
into in Table B to make sure they are the same type as in Table A. If they
are different, it will cause this error.
HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.
"Will_Harris_ZA" wrote:
> Hi
>
> I wish to append a new record to a separate table (before clearing the field
> contents for re-entry) using a command box. There are no other unique fields
> (the record entry form is a subform).
>
> Ie: Append new record in [TableA] to [TableB] using [MyID] (autonumber in
> [TableA]) to determine whether the current record is already in [TableB].
>
> Per recommendation (appended below after this msg), the query runs perfectly.
> Unfortunately however, [MyID] in [TableA] is an autonumber, and I believe it
> is causing me to get the error message:
> "Data type mismatch in criteria expression".
>
> None of my cells are Null. Is there something I can do to make the query
> read MyID not as an autonumber?
> Is this the issue here? Is there a more efficient means of performing this?
>
> Thanks in advance
> Will
>
> PS I have yet to go on VBA courses so please be gentle.
>
> "Ken Sheridan" wrote:
>
> > You'll need to run ... an append query to insert the new rows. ...For the sake of this example I'll assume a single column non-autonumber key called MyID, so the query would go like this:
>
> > To append new rows from table A to table B you need to identify those rows
> > in Table B which don't exist in Table B:
> >
> > INSERT INTO [Table B]
> > ([MyID], [Field1], [Field2], [Field 3],[Field 4])
> > SELECT [MyID], [Field1], [Field2], [Field 3],[Field 4]
> > FROM [Table A]
> > WHERE NOT EXISTS
> > (SELECT *
> > FROM [Table B]
> > WHERE [TableB].[MyID] = [TableA].[MyID];
|
|
0
|
|
|
|
Reply
|
Utf
|
5/16/2007 2:50:02 PM
|
|
Thank you Dale
You were on the money in changing [MyID] field in receptacle [TableB] to
long integer. Query subsequently ran perfectly.
Closing parenthesis was sorted in my query, think Ken inadvertently left it
out.
Many thanks for your help
Will
"Dale Fye" wrote:
> Will,
>
> The query below is missing a closing parenthesis. Does your query have that?
>
> Is the [MyID] field in table B a long integer, that is how Autonumber fields
> are defined? If not, change it and try your query again. It cannot be an
> Autonumber field in Table B!
>
> You might also want to check the parameters of the fields you are importing
> into in Table B to make sure they are the same type as in Table A. If they
> are different, it will cause this error.
>
> HTH
> Dale
> --
> Email address is not valid.
> Please reply to newsgroup only.
>
>
> "Will_Harris_ZA" wrote:
>
> > Hi
> >
> > I wish to append a new record to a separate table (before clearing the field
> > contents for re-entry) using a command box. There are no other unique fields
> > (the record entry form is a subform).
> >
> > Ie: Append new record in [TableA] to [TableB] using [MyID] (autonumber in
> > [TableA]) to determine whether the current record is already in [TableB].
> >
> > Per recommendation (appended below after this msg), the query runs perfectly.
> > Unfortunately however, [MyID] in [TableA] is an autonumber, and I believe it
> > is causing me to get the error message:
> > "Data type mismatch in criteria expression".
> >
> > None of my cells are Null. Is there something I can do to make the query
> > read MyID not as an autonumber?
> > Is this the issue here? Is there a more efficient means of performing this?
> >
> > Thanks in advance
> > Will
> >
> > PS I have yet to go on VBA courses so please be gentle.
> >
> > "Ken Sheridan" wrote:
> >
> > > You'll need to run ... an append query to insert the new rows. ...For the sake of this example I'll assume a single column non-autonumber key called MyID, so the query would go like this:
> >
> > > To append new rows from table A to table B you need to identify those rows
> > > in Table B which don't exist in Table B:
> > >
> > > INSERT INTO [Table B]
> > > ([MyID], [Field1], [Field2], [Field 3],[Field 4])
> > > SELECT [MyID], [Field1], [Field2], [Field 3],[Field 4]
> > > FROM [Table A]
> > > WHERE NOT EXISTS
> > > (SELECT *
> > > FROM [Table B]
> > > WHERE [TableB].[MyID] = [TableA].[MyID];
|
|
0
|
|
|
|
Reply
|
Utf
|
5/18/2007 7:09:00 AM
|
|
|
2 Replies
632 Views
(page loaded in 0.082 seconds)
Similiar Articles: Append query - current record only (follow on from Ken Stafford su ...Loop to update records - Microsoft Answers Ken Sheridan, Stafford ... the following year, and you don't want those updated, but only those for the same year as the ... Append current record Follow - Microsoft NewsgroupsAppend query - current record only (follow on from Ken Stafford su ... Help to create and Insert New Target Date record in Subform Follow Append query - current record ... eliminate message from append query to eliminate duplicate record ...Append query - current record only (follow on from Ken Stafford su ... eliminate message from append query to eliminate duplicate record ... Append query - current record ... Append Query Follow - Microsoft NewsgroupsAppend query - current record only (follow on from Ken Stafford su ... Hi I wish to append a new record to a separate table (before clearing the field contents for re ... Append to Table with Auto Number FollowAppend query - current record only (follow on from Ken Stafford su ... Will, The query below is missing a closing parenthesis. Does your query have that? Emailing Current Record Follow - Microsoft NewsgroupsAppend query - current record only (follow on from Ken Stafford su ... Email Current Record from Form Follow Email Current Record from Form - microsoft.public.access.forms ... Help to create and Insert New Target Date record in Subform FollowAppend query - current record only (follow on from Ken Stafford su ... Append query - current record only (follow on from Ken Stafford su ... Help to create and Insert New ... return primary key for record after append query FollowTarget Date record in Subform Follow Append query - current record ... ... Append query - current record only (follow on from Ken Stafford su ... HTH Dale ... query to ... last entry per record query.. Follow - Microsoft NewsgroupsAppend query - current record only (follow on from Ken Stafford su ... > > Per recommendation (appended below after this msg), the query runs ... subform - new record ... Append Query Re-run Follow - Microsoft NewsgroupsAppend query - current record only (follow on from Ken Stafford su ..... Ken Sheridan" wrote: > > > You'll need to run ... an append query to insert ... Append query - current record only (follow on from Ken Stafford su ...Loop to update records - Microsoft Answers Ken Sheridan, Stafford ... the following year, and you don't want those updated, but only those for the same year as the ... Append current record Follow - Microsoft NewsgroupsAppend query - current record only (follow on from Ken Stafford su ... Help to create and Insert New Target Date record in Subform Follow Append query - current record ... Copy record in same table... DataBase - DataBase Discussion List ...I use a query to only ... and paste-append the current record in a form with the following ... case an append query, as Al describes, should be used. Ken Sheridan Stafford ... Copy record in same table...an append query, however, so long as you only ... append the current record in a form with the following code ... query, as Al describes, should be used. Ken Sheridan Stafford ... Saving the data fields on Command - Microsoft Answersno i haven't tried an append query. I am not ... before your solution) in managing the current record ... Ken Sheridan, Stafford, England 7/26/2012 9:48:57 PM
|