473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Sum of values in multiple columns - Column names keep changing every week

Hello,

I have a problem with adding values...
If the table headers are unchanged then adding values from different columns is not a problem. But in my table, the headers keep changing every week.

Could someone please help me with the VBA code to add columns irrespective to the column names? One option I have is the header names start with OH 2300, OH 2301 ...

Is there anything like: DSum anything starts with OH or Like"OH *" ?
Jun 12 '12 #1
3 2264
Rabbit
12,516 Expert Mod 8TB
Your data structure is unnormalized. You need to normalize it so you don't have changing field names. That way you don't have so much trouble querying.
Jun 12 '12 #2
Hello Rabbit,

Thanks much for the reply.
I accept that the data structure is not normalized and there is no way for me to change it now.

Please let me know if there is any way to make it possible with the present data structure.
Jun 13 '12 #3
zmbd
5,501 Expert Mod 4TB
SriKumar
I can understand your pain about being "locked" into a poorly designed database; however, every momement that you spend to get that db into a normalized form will pay you back at least a hundred fold!

In the mean time please start with the following:

http://support.microsoft.com/kb/210362 Yes, it's for MSA2000; however, it still applies.

and
Expand|Select|Wrap|Line Numbers
  1. Sub FieldNames()
  2.     Dim zrs As Recordset
  3.     Dim zfld As Field
  4.     '
  5.     'establish the recordset
  6.     Set zrs = CurrentDb.OpenRecordset("YourTableNameHere")
  7.     '
  8.     'step thru the field names in the open table
  9.     For Each zfld In zrs.Fields
  10.         MsgBox (zfld.Name)
  11.     Next
  12.     '
  13.     'cleanup
  14.     zrs.Close
  15.     Set zrs = Nothing
  16. End Sub
DON'T ASK ME WHY I HAVE THAT JUST SITTING AROUND... yep... I had a DB that was not normalized... not anymore! Over 5 years of data in that monster and the tables were monsters! It's "fixed" now and I don't regret the time I spent on it at all!

-z
Jun 13 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matthew Cascio | last post by:
My understanding is that using reserved words as column names is allowable as long as they are quoted. I am trying to create a table dynamically with columns defined by the first row of a text...
1
by: noor | last post by:
Hi I have been working since 2 days to device a method to export sql table into csv format. I have tried using bcp with format option to keep the column names but I'm unable to transfer the file...
2
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table...
7
by: | last post by:
Need help finding simple way to retrieve a fields (or columns) collection from a Dataset without filling it first.
6
by: Mike S | last post by:
Hi all, A (possibly dumb) question, but I've had no luck finding a definitive answer to it. Suppose I have two tables, Employees and Employers, which both have a column named "Id": Employees...
18
by: Jen | last post by:
Is it possible (how) to display a new record every week (or day) from a recordset?
14
Boxcar74
by: Boxcar74 | last post by:
Ok I don’t know if this is possible. I Know SQL Ok and it’s been a while since I worked with VB. But what I’m trying to do is query by the dates in the column names. For instance I'm tracking...
10
by: dbruzzese84 | last post by:
I have been trying to work on this project but stumble across a few mistakes. Basically, I have a search form with 2 listboxes. When the user chooses both options and presses search, a table shows...
1
newnewbie
by: newnewbie | last post by:
Every week I get an Excel file that needs to be modified to be imported in Access. Modification includes columns renaming, deleting some of them, changing their order and data type, etc. I...
2
by: Infog | last post by:
I have written a chunk of code that automatically writes a SQL string, using parameters. The parameters themselves are easy, but getting the column names has been a problem. Is possible to get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.