We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,001 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Deleting part of a MS Access Record

Hi,

I am having problems with deleting part of a record. The record has approximately 15 different fields, and I only wish to delete 3 of them using the following piece of SQL coding:

DELETE [PMID 1], [PMName 1], [Price 1] FROM Subscriptions WHERE [Customer ID]="001"

The code works absolutely fine, but it just doesn't do what I want it to. Instead of deleting those 3 fields, it deletes the entire row, which isn't very helpful.

Any ideas on how to solve this problem?

Thanks in advance :)

2
Contributors
2
Replies
8 Hours
Discussion Span
1 Year Ago
Last Updated
3
Views
Question
Answered
collin_ola
Junior Poster in Training
55 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

The SQL statement "DELETE" is used to remove an entire row. It appears what you want is to set values in specific columns of an existing row to NULL. You do this with an UPDATE statement. Try this:

UPDATE Subscriptions
set [PMID 1] = NULL, [PMName 1] = NULL, [Price 1] = NULL
where [Customer ID] = "001"

You just have to make sure that the columns allow for NULL (as in "Allow Zero Length" set to Yes in the table definition.

Hope this helps! Good luck!

BitBlt
Practically a Posting Shark
894 posts since Feb 2011
Reputation Points: 482
Solved Threads: 148
Skill Endorsements: 14

Worked perfectly, thanks a lot :D

collin_ola
Junior Poster in Training
55 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Year Ago by BitBlt

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0627 seconds using 2.66MB