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!

How do i delete certain fields from a table from a macro?

Status
Not open for further replies.

ODBCERRORKING

Technical User
Mar 29, 2001
27
US
i was wondering id i could write some type of macro to delete certain fields from a table.i know i could probably write some code but dont know any or even wher i write it. could somone fill me in?
 
I don't know how to do it using a macro, but it's not too bad using code.

You can create a form which contains a list box that shows all the fields of a table. To do this, create a new form and put a list box on it. If the list box wizard starts, cancel out of it. Right click on the list box and then choose properties. In the properties box, choose the data tab. In the Row Source Type, choose Field List, and in Row Source choose the table name. Click on the Other tab and choose MultiSelect Simple (or Extended). Choose View -> Form View from the menu, or click on the form icon on the toolbar to see what you get.

You can select any number of fields. You can then create a button that runs code after the fields are selected to remove the fields from your table.

Does that sound like what you want to do?

Then you can Kathryn


 
What do you mean by delete certain fields? Do you want to remove the fields from the table or merely delete the content in specific fields for some or all records?
 
Kathryn,
that sounnds good but i dont know how to write the code behind the button to delete the fields.i would be using this procedure to format fields and export to a file so every time i clean the data i have extra fields that are there everytime. help! there has got to be a easy way!
pfunk
 
Glad you posted that extra bit of explanation. Are trying to delete the fields so that they are not exported? If so, you may not have to.

You can create a query with just the fields you want and then export the query instead of the table.

Would that work for you? If not, let me know why not. Worse comes to worse, we can write the code necessary. Kathryn


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top