Access 2010 SQL Problem

pinkpanther6666

Board Regular
Joined
Feb 13, 2008
Messages
194
Office Version
  1. 365
Platform
  1. Windows
Hi All,

Wondering if anyone could help me on this Access 2010 SQL problem I have.

My tables are as follows:-

Table name .......... Main
Field Name 1 .......... Name
Field Name 2 .......... Gender


Table Name ............ Player
Field Name 1 ............ PlayerName
field Name 2 ............ Gender

In the player table for some records the value is set to 1

What the sql code below is suppose to do is to get all the playername where the gender =1 and then sets the player gender to 1 in the main table

But its not working

UPDATE Main SET Gender = 1
WHERE Name IN
(SELECT PlayerName FROM Player WHERE Gender = 1)




Can Anyone help please

Many thanks in advance


Steve
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Unable to recreate your issue. The Query updates for me. However, the Field name "Name" is a reserved word. Suggest you change the field name which is what I did and the Update Query works for me.
 
Upvote 0
Alansidman,

Many thanks for your reply

i have changed the name to ABC and still get the error of "type mismatch in expression"

my sql code is

UPDATE Main SET Gender = 1
WHERE ABC
IN (SELECT PlayerName FROM Player WHERE Gender = 1);

Any other thoughts



Steve
 
Upvote 0
Alansidman

Just had a thought ........... the Gender Field in the Main table is a combo box ......... would that make a difference


Cheers

Steve
 
Upvote 0

Forum statistics

Threads
1,221,825
Messages
6,162,165
Members
451,750
Latest member
dofrancis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top