A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Update a boolean field



 
 
Thread Tools Display Modes
  #1  
Old November 20th, 2006, 09:00 PM posted to microsoft.public.access.queries
jac007
external usenet poster
 
Posts: 28
Default Update a boolean field

I have two tables that are being compared. If field_1 from TABLE B is the
same as field1 from TABLE A, then there QCTV1 field from TABLE A should have
a check else is should be left unchecked. How do I do this? Note: TABLE A has
many QCTV fields because many fields from TABLE B are being compared to the
some fields in TABLE A.

TABLE A TABLE B
PK field1 QCTV1 field2 QCTV2 PK field_1 field_2
field_3
01 tom NULL VA NULL 01 tom VA 29128
02 Jerry NULL MD NULL 02 Marry MD
79345
  #2  
Old November 21st, 2006, 12:08 AM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Update a boolean field

Back up your database and then try this ---
UPDATE [Table A] INNER JOIN [Table B] ON [Table A].PK = [Table B].PK SET
[Table A].QCTV1 = IIf([Table A].[field1]=[Table B].[field1],-1,0), [Table
A].QCTV2 = IIf([Table A].[field2]=[Table B].[field2],-1,0);


"jac007" wrote:

I have two tables that are being compared. If field_1 from TABLE B is the
same as field1 from TABLE A, then there QCTV1 field from TABLE A should have
a check else is should be left unchecked. How do I do this? Note: TABLE A has
many QCTV fields because many fields from TABLE B are being compared to the
some fields in TABLE A.

TABLE A TABLE B
PK field1 QCTV1 field2 QCTV2 PK field_1 field_2
field_3
01 tom NULL VA NULL 01 tom VA 29128
02 Jerry NULL MD NULL 02 Marry MD
79345

  #3  
Old November 21st, 2006, 02:09 PM posted to microsoft.public.access.queries
jac007
external usenet poster
 
Posts: 28
Default Update a boolean field

Thanks, it worked!

"KARL DEWEY" wrote:

Back up your database and then try this ---
UPDATE [Table A] INNER JOIN [Table B] ON [Table A].PK = [Table B].PK SET
[Table A].QCTV1 = IIf([Table A].[field1]=[Table B].[field1],-1,0), [Table
A].QCTV2 = IIf([Table A].[field2]=[Table B].[field2],-1,0);


"jac007" wrote:

I have two tables that are being compared. If field_1 from TABLE B is the
same as field1 from TABLE A, then there QCTV1 field from TABLE A should have
a check else is should be left unchecked. How do I do this? Note: TABLE A has
many QCTV fields because many fields from TABLE B are being compared to the
some fields in TABLE A.

TABLE A TABLE B
PK field1 QCTV1 field2 QCTV2 PK field_1 field_2
field_3
01 tom NULL VA NULL 01 tom VA 29128
02 Jerry NULL MD NULL 02 Marry MD
79345

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:18 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.