473,503 Members | 3,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question: automatically generating field names from record values

HD
Hello. For the following, I would appreciate if anyone could tell me:
if it can be done, how it might done, and/or what search terms I could
use to find the solution myself.

I would like to create a database in which _adding a new record
automatically creates a new field in the table_ (ideally, deleting a
record would also delete the field that was created when that record
was added). Thus, the number of fields in the table would always
equal the number of records. In essence, I want Access to
automatically generate a crosstab, but one that will allow for data
entry (and thus, a crosstab query will not work for my purposes - at
least not as I understand them).

Here is a hypothetical example. Suppose I have a database table that
contains a list of employee names:

Mary
Ed
John
Rick
Kathy

And suppose that I would like to create a table that will allow me to
specify which employees work well with each other, via a simple yes/no
entry. Ultimately, I want a table that will look like this:

Mary Ed John Rick Kathy

Mary - y n y y

Ed (y) - y y y

John (n) (y) - n n

Rick (y) (y) (n) - y

Kathy (y) (y) (n) (y) -
The values in parentheses would (ideally) be automatically generated,
as they have already been entered above the diagonal.

Any ideas? It has occurred to me that perhaps I do not need to
"generate" the field names from values. If it is possible to
"autonumber" field names (i.e., Employee1, Employee2, Employee3...),
perhaps I could have the field names correspond to an autonumber
field, without actually trying to generate column names from field
values.

I would appreciate any advice you can offer about how I might
accomplish this without having to manually add and delete fields each
time I add and delete the corresponding record.

Thanks.

HD
Nov 13 '05 #1
6 1737

"HD" <he******@yahoo.com> wrote in message
news:cc**************************@posting.google.c om...
Hello. For the following, I would appreciate if anyone could tell me:
if it can be done, how it might done, and/or what search terms I could
use to find the solution myself.

I would like to create a database in which _adding a new record
automatically creates a new field in the table_ (ideally, deleting a
record would also delete the field that was created when that record
was added). Thus, the number of fields in the table would always
equal the number of records. In essence, I want Access to
automatically generate a crosstab, but one that will allow for data
entry (and thus, a crosstab query will not work for my purposes - at
least not as I understand them).

Here is a hypothetical example. Suppose I have a database table that
contains a list of employee names:

Mary
Ed
John
Rick
Kathy

And suppose that I would like to create a table that will allow me to
specify which employees work well with each other, via a simple yes/no
entry. Ultimately, I want a table that will look like this:

Mary Ed John Rick Kathy

Mary - y n y y

Ed (y) - y y y

John (n) (y) - n n

Rick (y) (y) (n) - y

Kathy (y) (y) (n) (y) -
The values in parentheses would (ideally) be automatically generated,
as they have already been entered above the diagonal.

Any ideas? It has occurred to me that perhaps I do not need to
"generate" the field names from values. If it is possible to
"autonumber" field names (i.e., Employee1, Employee2, Employee3...),
perhaps I could have the field names correspond to an autonumber
field, without actually trying to generate column names from field
values.

I would appreciate any advice you can offer about how I might
accomplish this without having to manually add and delete fields each
time I add and delete the corresponding record.

Thanks.

HD


You're joking, right? If not, send your question to:

ac***********@hotmail.com


Nov 13 '05 #2
he******@yahoo.com (HD) wrote:
I would like to create a database in which _adding a new record
automatically creates a new field in the table_ (ideally, deleting a
record would also delete the field that was created when that record
was added). Thus, the number of fields in the table would always
equal the number of records. In essence, I want Access to
automatically generate a crosstab, but one that will allow for data
entry (and thus, a crosstab query will not work for my purposes - at
least not as I understand them).

Here is a hypothetical example. Suppose I have a database table that
contains a list of employee names:

Mary
Ed
John
Rick
Kathy

And suppose that I would like to create a table that will allow me to
specify which employees work well with each other, via a simple yes/no
entry. Ultimately, I want a table that will look like this:

Mary Ed John Rick Kathy

Mary - y n y y

Ed (y) - y y y

John (n) (y) - n n

Rick (y) (y) (n) - y

Kathy (y) (y) (n) (y) -
You really should be using two tables for this purpose. One containing the employee
names and another containg two employee IDs along with other data such as your y/n.

Your report can be generated by programmatically creating the cross tab query and
updating the heading labels on the report. It's a bit of work requiring VBA
knowledge but doable.
I would appreciate any advice you can offer about how I might
accomplish this without having to manually add and delete fields each
time I add and delete the corresponding record.


If you really, really, want to do this see the TempTables.MDB page at my website
which illustrates how to use a temporary MDB in your app.
http://www.granite.ab.ca/access/temptables.htm This will have the necessary code to
create fields.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 13 '05 #3
"XMVP" <ac***********@hotmail.com> wrote:
X-DMCA-Complaints-To: ab***@vnet-inc.com


Please ignore the above posting and others which are somewhat bizarre.

Note to persons new to this newsgroup. One person, with many identities, is being
rather disruptive. If you see a bizarre posting it's probably the work of this
disruptive person..

Check the headers of the posting. If you see the following the posting likely can be
ignored. Of course, there will likely be other headers to be added to this list.

Comments: This message did not originate from the Sender address above.
It was remailed automatically by anonymizing remailer software.
or
X-Abuse-Report: ab***@teranews.com
or
Organization: Posted via Supernews, http://www.supernews.com
or
Organization: 100ProofNews.com - Unlimited Downloads - $8.95/Month
or
X-Complaints-To: ab***@vnet-inc.com
or
Message-ID: <something>.nntpserver.com

You can also change your NewsReader program settings to ignore off-topic posts. See
http://www.hyphenologist.co.uk/killfile/ for more information.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 13 '05 #4

If you really, really, want to do this see the TempTables.MDB page at my website which illustrates how to use a temporary MDB in your app.
http://www.granite.ab.ca/access/temptables.htm This will have the necessary code to create fields.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm

Please ignore the illegal advertising by the above poster and other
violations of this newsgroup's charter.

Tony is no longer an Access MVP or a member of this newsgroup.


Nov 13 '05 #5
"XMVP" <ac***********@hotmail.com> wrote:
Tony is no longer an Access MVP or a member of this newsgroup.


Rubbish.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 13 '05 #6
"Tony Toews" <tt****@telusplanet.net> wrote in message
news:uo********************************@4ax.com...

You really should be using two tables for this purpose. One containing the employee names and another containg two employee IDs along with other data such as

your y/n.
I wonder how to write the ddl for this. If you do this:-

create table employees
(
empID int not null primary key,
empName varchar(255) not null unique
)

create table employeeCompatabilties
(
empID int not null references employees(empID),
empID2 int not null references employees(empID),
isCompatible char(1) not null,
primary key (empID, empID2),
check (isCompatible in ('y', 'n'))
)
Then you could have the situation where John is compatible with Mary but
Mary is not compatible with John. Well, maybe that could be true :)

Anyway, something to think about..
Nov 13 '05 #7

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

Similar topics

4
3006
by: Justin Lebar | last post by:
Sorry about the huge post, but I think this is the amount of information necessary for someone to help me with a good answer. I'm writing a statistical analysis program in ASP.net and MSSQL7 that...
15
2137
by: C White | last post by:
I've got another drop list problem I am using the following code where users select a name, but it should pass a name and email into the table <select name="user"> <option value="<%...
55
4594
by: Steve Jorgensen | last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of multiple parameters in a Property Let procedure to pass dimensional arguments on the basis that, although it works, it's...
4
2718
by: Andy Proctor | last post by:
I hope there is an answer out there.... I have a simple database structured like this (non relevant tables and fields omitted) Members table memberID memberFname memberLname memberNokID
3
2727
by: windandwaves | last post by:
Hi Gurus Does anyone know how I set the error trapping to option 2 in visual basic. I know that you can go to tools, options and then choose on unhandled errors only, but is there a VB command...
11
2514
by: Gary | last post by:
I'm using Access 2002. I have a field called Job No. It is a text (data type). The reason being that there is an "I" in front of each number i.e. I1234 I1235 etc The problem is that when...
29
3537
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
17
2031
by: (PeteCresswell) | last post by:
I've got apps where you *really* wouldn't want to delete certain items by accident, but the users just have to have a "Delete" button. My current strategies: Plan A:...
30
2959
by: valley | last post by:
Hello, Here I try to reform my question from the thread below which was closed as it got too complicated. http://www.thescripts.com/forum/threadnav562674-4-10.html The Forum answer to my...
0
7192
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7445
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
5559
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,...
1
4991
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
4665
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...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.