Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TAble Code

Status
Not open for further replies.

mbevon

Technical User
May 18, 2001
5
GY


hii alll
I need some help


How could i delete all the empty fields in a table using Code?

Thanks
 
mbevon:

Do you mean delete all records that have empty fields?

When I need to delete a record from a table based on an empty field I use:

DoCmd.RunSQL"DELETE Minority.*, Minority.Category FROM Minority WHERE (((Minority.Category) Is Null Or(Minority.Category)=' '));"

What this does is, it will delete all records from my Minority table where the field category is Null or has an empty string.
 

Here is an example of the problem eg, tb1 is the table

tb1

1997 1998 1999
11
125


In the above eg i want to delete field: 1999 using code because it's empty.
 
Not really sure how this is done, but I am sure someone here will be able to help. But... I think you should look into a redesign. A table like this should probably have a Field for the year and then a field for the value, instead of fields for every year you may have a value for. It will make things a lot easier for you down the road... Terry M. Hoey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top