473,416 Members | 1,837 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,416 software developers and data experts.

Is it possible to store table field names in array then use to update table

Hi I am using WinXP and Access 2003
Is it possible to store the field names of a table in an array and then
loop through the array and update the table using the field names stored
in the array? I can't figure out the coding to accomplish this.
I have an Excel application that is a monster and it has become too much
to maintain and test. I didn't write it but i support it. I am trying to
convert this application to Access and it is not as easy as it sounds.
Lots of field names and lots of tables. I have actually exceeded the
maximum number of field names in a table causing me to breakdown the
data and create more tables...

TIS

Tim Hunter

*** Sent via Developersdex http://www.developersdex.com ***
Jan 25 '07 #1
11 10267
rkc
Tim Hunter wrote:
Hi I am using WinXP and Access 2003
Is it possible to store the field names of a table in an array and then
loop through the array and update the table using the field names stored
in the array? I can't figure out the coding to accomplish this.
I have an Excel application that is a monster and it has become too much
to maintain and test. I didn't write it but i support it. I am trying to
convert this application to Access and it is not as easy as it sounds.
Lots of field names and lots of tables. I have actually exceeded the
maximum number of field names in a table causing me to breakdown the
data and create more tables...
Come on now, creating an Access application is as simple as selecting
one of the many pre-made templates and entering or tranfering your data.
Anyone can point and click their way to success without ever having to
consult with a ridiculously highly paid database developer. Some of
them already have enough money as it is any way.

Spending some time reading up on relational database design in general
and normalization in particular might also be of some value.

To answer your question, yes it is. How would that help?
Jan 25 '07 #2
"Tim Hunter" <th*****@rochester.rr.comwrote
Hi I am using WinXP and Access 2003
Is it possible to store the field names of a table
in an array and then loop through the array and
update the table using the field names stored
in the array?
"Yes," as rkc said, "it is."

"No," I say, "it is almost certainly not what you SHOULD be doing."

From your description, it sounds as if you are "committing spreadsheet" --
wanting to use Access as nothing but a bigger version of Excel, that can
handle more rows and columns. I agree that you need to carefully review what
business functions you need to accomplish, and how you need to structure and
use the data -- which, in a database, will not be tables with so many
columns you bump into Access' limitations.

Where I disagree with rkc (and I think he was being somewhat facetious) is
that I think you might well benefit if you contract with an experienced
Access developer to work with you and from whom you might learn. But, even
before that, check out the recommended self-study books at
http://www.mvps.org/access and other sites.

Some of my favorites are:

"Microsoft Access Step-by-Step" from Microsoft Press for the raw Access
beginner

"Microsoft Access 2003 Inside-Out" by John Viescas, from Microsoft Press, or
"Special Edition Using Microsoft Access <version>" by Roger Jennings, from
Que,
both of which start from the beginning but go farther into development than
the Step-by-Step books

"Microsoft Access <versionDeveloper's Handbook" by Litwin, Getz, et al,
from SYBEX for the intermediate to advanced developer

but there are many books available, and most of them are good -- but not if
they just sit on the shelf at the bookstore.

Larry Linson
Microsoft Access MVP


Jan 25 '07 #3
Gentleman,
I asked a simple question I didn't expect to be attacked. I have 40 plus
years in development and I have been developing in Access for about 10
years. This doesn't make me an expert by any means and I may not be at
your level, but I do know my way around in Access. Before I refuse a
paying client because something isn't politically correct, I exaust all
possibilities and that is what i am doing at this moment. There are many
ways to skin this cat and using Access and arrays is one idea I thought
might work.

Thank you

Tim Hunter

*** Sent via Developersdex http://www.developersdex.com ***
Jan 25 '07 #4


On Jan 25, 4:35 pm, Tim Hunter <thun...@rochester.rr.comwrote:
Gentleman,
I asked a simple question I didn't expect to be attacked. I have 40 plus
years in development and I have been developing in Access for about 10
years. This doesn't make me an expert by any means and I may not be at
your level, but I do know my way around in Access. Before I refuse a
paying client because something isn't politically correct, I exaust all
possibilities and that is what i am doing at this moment. There are many
ways to skin this cat and using Access and arrays is one idea I thought
might work.

Thank you

Tim Hunter

*** Sent via Developersdexhttp://www.developersdex.com***
Does this help?
Sub foo()
Dim ColumnNames As Variant
Dim ColumnValues As Variant
Dim i As Integer
Dim rst As DAO.Recordset

ColumnNames = Array("Column1", "Column2", "Column3")
ColumnValues = Array("foo", "bar", "baz")

Set rst = CurrentDb.OpenRecordset("Table1", dbOpenDynaset)
rst.AddNew
For i = 0 To 2
rst(ColumnNames(i)).Value = ColumnValues(i)
Next
rst.Update
rst.Close
Set rst = Nothing
End Sub

Jan 25 '07 #5
Tim Hunter wrote:
>Before I refuse a
paying client because something isn't politically correct, I exaust all
possibilities and that is what i am doing at this moment.
Hi Tim,

I didn't think you weren't attacked.

But the above concerns me... are you saying that if a client requests
something that is not a good idea that you will try to do it anyway? I
would think that one of the purposes of those of us who provide our
expertise in information technology to lay folk would be to advise
against poor choices and do our best to guide them correctly....
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Jan 25 '07 #6
Ahhhh, I've been waiting for someone to ask this question and a good
question it is. Certainly I consider myself an Information Systems
Professional (Semi-Retired) and under that umbrella I want to develop
good industrial strength applications that follow good design concepts
using good coding conventions. Having said that, I also am not a person
to say that something can't be done unless I have a good understanding
of why it either can't or shouldn't. I try to keep an open mind when I
do my research and I always come away with much more knowledge than I
started with. What I end up with for the application that I am working
on now is my decision and the customer will more than likely follow my
recommendations, but I had better know what I am talking about when i
talk to him or I won't be there for long...

Respectfully

Tim Hunter

*** Sent via Developersdex http://www.developersdex.com ***
Jan 26 '07 #7
Thank you very much, this is exactly what I couldn't figure out on my
own. I tested this and it works just fine. Why I love this Web Site is
because being semi-retired I can't walk over to the next cube and ask a
question. You guys are my next cube...

Thank you ver much

Tim Hunter

*** Sent via Developersdex http://www.developersdex.com ***
Jan 26 '07 #8
rkc wrote:
Tim Hunter wrote:
Hi I am using WinXP and Access 2003
Is it possible to store the field names of a table in an array and then
loop through the array and update the table using the field names stored
in the array? I can't figure out the coding to accomplish this.
I have an Excel application that is a monster and it has become too much
to maintain and test. I didn't write it but i support it. I am trying to
convert this application to Access and it is not as easy as it sounds.
Lots of field names and lots of tables. I have actually exceeded the
maximum number of field names in a table causing me to breakdown the
data and create more tables...

Come on now, creating an Access application is as simple as selecting
one of the many pre-made templates and entering or tranfering your data.
Anyone can point and click their way to success without ever having to
consult with a ridiculously highly paid database developer. Some of
them already have enough money as it is any way.

Spending some time reading up on relational database design in general
and normalization in particular might also be of some value.

To answer your question, yes it is. How would that help?
What's happening here, rkc? Is this thread some kind of troll or test?
There's gotta be some explanation. My guess is that it's some kind of
bet between you and the original poster where he makes some posts that
are stupider than can be imagined and a few bucks are going to change
hands on the basis of the general tone of the answers.

Jan 26 '07 #9
Tim Hunter <th*****@rochester.rr.comwrote in
news:45*********************@news.qwest.net:
Thank you very much, this is exactly what I couldn't figure out on
my own. I tested this and it works just fine. Why I love this Web
Site is because being semi-retired I can't walk over to the next
cube and ask a question. You guys are my next cube...
Um, you aren't using a website. You're using a Usenet group.
AccessMonster is just a website that is a gateway to Usenet, a very
poor one, at that.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 26 '07 #10
rkc <rk*@rochester.yabba.dabba.do.rr.bombwrote in
news:45***********************@roadrunner.com:
Tim Hunter wrote:
>Hi I am using WinXP and Access 2003
Is it possible to store the field names of a table in an array
and then loop through the array and update the table using the
field names stored in the array? I can't figure out the coding to
accomplish this. I have an Excel application that is a monster
and it has become too much to maintain and test. I didn't write
it but i support it. I am trying to convert this application to
Access and it is not as easy as it sounds. Lots of field names
and lots of tables. I have actually exceeded the maximum number
of field names in a table causing me to breakdown the data and
create more tables...

Come on now, creating an Access application is as simple as
selecting one of the many pre-made templates and entering or
tranfering your data. Anyone can point and click their way to
success without ever having to consult with a ridiculously highly
paid database developer. Some of them already have enough money as
it is any way.
I think you should have put <sarcasm></sarcasmtags around that, as
I assume you were being sarcastic.

I think Access makes it quite easy to create tables and queries and
forms and reports and macros. But I don't think it makes it easy to
do any of those things properly or well. That requires knowledge and
experience, and that's why I read your quoted paragraph as being
sarcastic.

My experience is that most novices don't have the background in data
schema design and that leads them to most of their problems. As
Larry said, this looks like a case where a spreadsheet-type design
is being used, and that's one of the most common causes of major
problems in designing a database application, i.e., a non-normalized
design.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 26 '07 #11
Tim Hunter <th*****@rochester.rr.comwrote in
news:45*********************@news.qwest.net:
Is it possible to store the field names of a table in an array and
then loop through the array and update the table using the field
names stored in the array? I can't figure out the coding to
accomplish this. I have an Excel application that is a monster and
it has become too much to maintain and test. I didn't write it but
i support it. I am trying to convert this application to Access
and it is not as easy as it sounds. Lots of field names and lots
of tables. I have actually exceeded the maximum number of field
names in a table causing me to breakdown the data and create more
tables...
Two things:

1. you clearly have schema problems. If you'll post a description of
what you have I'm sure we can all help with making a better design,
which will likely involve breaking down that single spreadsheet into
a number of related tables. There's even a wizard to analyze your
data and do it for you, though I can't say I've ever found the
results helpful in getting to a final design (it usually misses
something important, and undoing that is harder than just doing it
manually in the first place).

2. walking through a bunch of records one-by-one and making changes
to them one-by-one is a procedural approach to data editing, and is
very inefficient. While doing so is necessary in a very few cases
where you need to make changes based on the context within a set of
records (i.e., the values you need in one record depend on the
values that are in other records in the same data set), in most
situations you should use SQL UPDATE queries to make the changes
instead. These will be far, far faster than changing the same
records sequentially. If you want to get into databases, you need to
learn SQL, so I would suggest that instead of just using the
sequential code that someone posted for you, try accomplishing the
task with an UPDATE query. The Access query designer is one of the
best tools for learning how to do this, as it makes it pretty darned
easy to create such queries.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 26 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: jacob nikom | last post by:
Hi, I would like to store XML files in MySQL. What is the best solution: 1. Convert it to string and store it as CLOB/text 2. Serialize it and store as byte array 3. Flatten it out and create...
1
by: Randy | last post by:
Access= 2002 I'm NOT a Programmer, but I have used VB in the past to do some things ( Spaghetti Code King) so I have some understanding of Coding I need to replace a text field (teacher) in...
8
by: brian kaufmann | last post by:
Hi, I'm new to Access and this may be a basic question but I would appreciate it if you could let me know how to do this: I've created an Access table and would like to insert a column with...
5
by: JonH | last post by:
Ok, I have this dynamically created table in my one of my php forms that shows the names of the people the user has entered into a text field. When they hit add a row displays, showing the name...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
5
by: eric.nguyen312 | last post by:
I have an amend button which when clicked puts the Job form into edit. When saved, Access backs up old job information into 'AmendedJobBackUp' table. What I want is to add a new column...
4
by: Bob | last post by:
Hi all, I've got a table that I've imported and it has junk at the top of the table, so after import I run a delete query to remove the junk lines then I'm left with the field names I want for...
4
prabunewindia
by: prabunewindia | last post by:
Hello everybody, here i am going to explain, how to get mails from Outlook express database and store in our own database(local) Initially you have to add the refference Outlook library10.0 or...
3
by: Daniel | last post by:
We have a MS Access Db that is on certain pc's within our locations.. so that comes out to be around 40+ databases.. ( old software ) each of those pc's dont have MS Access loaded on them( this...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.