Link to home
Start Free TrialLog in
Avatar of Computer Guy
Computer Guy

asked on

SQL Statement Help

Hi,

In access - I have 1 table with 10,000 usernames 'users', I have a list of 2,500 that need to be deleted.

I was thinking the best was to do this to create a new table 'data_to_delete' with 1 column 'usernames'

Then I run a SQL statement

DELETE FROM users
WHERE data_to_delete.usernames=*;

Any ideas on the correct syntax?
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

try this, create a backup of users table first.

delete * from users
where users.usernames in (select usernames from data_to_delete)
Avatar of Computer Guy
Computer Guy

ASKER

I get an invalid memo ole or hyperlink object in subquery error
what is the data type of the field usernames? are they hyperlinked?

upload a copy of the db
Sort of new problem. I created a test database and when I created a query it populates a textbox for me to enter in data to delete.
Database1.accdb
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome! I still got the same Hyperlink error, and I changed the data type from Long Text to Short Text and that fixed it. Any clue why that is?

The comparison data is LongText
There is no LongText Data type in access. (Only Text and Memo)

In Access use Text for the Data Type for the user field.

where is your data coming from?  mySQL?
<<There is no LongText Data type in access. (Only Text and Memo) >>

Long/short text were introduced in Office/Access 2013, replacing Text/Memo:

http://www.dummies.com/how-to/content/tips-for-choosing-field-types-in-access-2013.html