简体   繁体   中英

How to change field headers with VBA using data from the dataset?

I have an Access table that has generic headers. In the table each column is populated with the number of parts ordered for a given day. One column is populated with the beginning date. This information changes weekly. I would like the generic column names to be changed to a meaningful date name using the starting date in the field data. Does anyone have any ideas?

Forget about chancing fields names - that will lead to endless troubles.

You could change the Caption of the field names, but that can also create a lot of confusion.

Best option is to use a query where you alias the field names. The SQL property of this is simple text you easily can manipulate:

Select Field1 As Something, Field2 As SomethingElse
From YourTable

That said …

In the table each column is populated with the number of parts ordered for a given day.

it sounds like you use the table as a spreadsheet.

That's a sure no-go, and you should read up on how to normalize a database - many guides are out there for the browsing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM