1,105,214 Community Members

Deleting part of a MS Access Record

Member Avatar
collin_ola
Junior Poster in Training
55 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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 :)

Member Avatar
BitBlt
Practically a Posting Shark
895 posts since Feb 2011
Reputation Points: 442 [?]
Q&As Helped to Solve: 163 [?]
Skill Endorsements: 16 [?]
Featured
 
1
 

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!

Member Avatar
collin_ola
Junior Poster in Training
55 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Worked perfectly, thanks a lot :D

Question Answered as of 2 Years Ago by BitBlt
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: