A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I create an Access 2007 table using VBA?



 
 
Thread Tools Display Modes
  #1  
Old August 21st, 2008, 09:36 PM posted to microsoft.public.access.tablesdbdesign
DavidB
external usenet poster
 
Posts: 53
Default How do I create an Access 2007 table using VBA?

I'm writing a Access 2007 db to help with inventory control that contains a
crosstab table which pulls together a product's descriptive elements to make
a model part number for the product. The query then lists each part's serial
number below the part number in a column. I want to then take that part
number and dynamically make a table-field out of it with the serial numbers
listed below. Since this value can change each time the query is run, the
table has to be dynamic and cleared after each use. I've found that crosstab
queries don't play well with the make-table option in queries or with reports
at gen time. I thought that by leaving the query as a select query, then
programmatically creating the table fields, I could get around this
irritation. Any ideas?
  #2  
Old August 21st, 2008, 10:37 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default How do I create an Access 2007 table using VBA?

David

It sounds like you are trying to dynamically create new fields named after
partnumbers. If so, that approach embeds data (partnumber) in field names,
a no-no in a relational database.

You've asked a "how" question. It all starts with the data ... please
describe the data you're working with.

Regards

Jeff Boyce
Microsoft Office/Access MVP


"DavidB" wrote in message
...
I'm writing a Access 2007 db to help with inventory control that contains
a
crosstab table which pulls together a product's descriptive elements to
make
a model part number for the product. The query then lists each part's
serial
number below the part number in a column. I want to then take that part
number and dynamically make a table-field out of it with the serial
numbers
listed below. Since this value can change each time the query is run, the
table has to be dynamic and cleared after each use. I've found that
crosstab
queries don't play well with the make-table option in queries or with
reports
at gen time. I thought that by leaving the query as a select query, then
programmatically creating the table fields, I could get around this
irritation. Any ideas?



  #3  
Old August 22nd, 2008, 12:16 AM posted to microsoft.public.access.tablesdbdesign
Piet Linden[_2_]
external usenet poster
 
Posts: 280
Default How do I create an Access 2007 table using VBA?

On Aug 21, 3:36*pm, DavidB wrote:
I'm writing a Access 2007 db to help with inventory control that contains a
crosstab table which pulls together a product's descriptive elements to make
a model part number for the product. The query then lists each part's serial
number below the part number in a column. I want to then take that part
number and dynamically make a table-field out of it with the serial numbers
listed below. Since this value can change each time the query is run, the
table has to be dynamic and cleared after each use. I've found that crosstab
queries don't play well with the make-table option in queries or with reports
at gen time. I thought that by leaving the query as a select query, then
programmatically creating the table fields, I could get around this
irritation. Any ideas?


I agree with Jeff. I spent six months working on projects that, if
built correctly (not storing facts in field names), would have taken
one day instead of six months to do... you would be making an enormous
amount of work for yourself. And the code to sort the mess out was
not trivial.
  #4  
Old August 22nd, 2008, 03:55 AM posted to microsoft.public.access.tablesdbdesign
DavidB
external usenet poster
 
Posts: 53
Default How do I create an Access 2007 table using VBA?

No doubt that this is a significant (but creative) challenge.
To describe the data. I have Dell computers that my company obtains from a
client and is responsible to resell. I have developed a database system that
through scanning the service tag & the client's asset tag, enables me to
track the device from the time it enters the door to our warehouse till the
time I resell it. I'm trying to develop a bill of sale that allows me to
segregate the data by the pc descriptive information (ex: GX240 BLK/[client
service tag]) so that I can list each device sold by the descriptive info in
a column. It seems to me that if I can list each sold item (which can be from
one model to ten different models, based on what is available to sell) under
the descriptive info about that item, it would be most efficient. This
information will also be stored in an "Items Sold" table that is indexed by
the type of purchaser (reseller, commercial, or employee). The data will be
used to generate a report (dynamically) and then the table (and report)
deleted from the database programmatically. Since I've performed dynamic
report generation and maintenance functions before, I don't expect to have
too much trouble with those. In fact, I can currently generate the data I
need using a crosstab query, but as stated before, it's a dumb query that is
only good for display purposes. The easiest fix that I can see would be to
find a way to use the crosstab; I've tried everything I can think of except
exporting it to excel & re-importing as a table.
Hope this helps.
"Jeff Boyce" wrote:

David

It sounds like you are trying to dynamically create new fields named after
partnumbers. If so, that approach embeds data (partnumber) in field names,
a no-no in a relational database.

You've asked a "how" question. It all starts with the data ... please
describe the data you're working with.

Regards

Jeff Boyce
Microsoft Office/Access MVP


"DavidB" wrote in message
...
I'm writing a Access 2007 db to help with inventory control that contains
a
crosstab table which pulls together a product's descriptive elements to
make
a model part number for the product. The query then lists each part's
serial
number below the part number in a column. I want to then take that part
number and dynamically make a table-field out of it with the serial
numbers
listed below. Since this value can change each time the query is run, the
table has to be dynamic and cleared after each use. I've found that
crosstab
queries don't play well with the make-table option in queries or with
reports
at gen time. I thought that by leaving the query as a select query, then
programmatically creating the table fields, I could get around this
irritation. Any ideas?




  #5  
Old August 22nd, 2008, 04:10 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default How do I create an Access 2007 table using VBA?

David

(see comments in-line below)

"DavidB" wrote in message
...
No doubt that this is a significant (but creative) challenge.
To describe the data. I have Dell computers that my company obtains from a
client and is responsible to resell. I have developed a database system
that
through scanning the service tag & the client's asset tag, enables me to
track the device from the time it enters the door to our warehouse till
the
time I resell it. I'm trying to develop a bill of sale that allows me to
segregate the data by the pc descriptive information (ex: GX240
BLK/[client
service tag]) so that I can list each device sold by the descriptive info
in
a column.


If you have a table that lists equipment, you can join that table to a
SoldItem table to get a query that displays "pc descriptive info".

It seems to me that if I can list each sold item (which can be from
one model to ten different models, based on what is available to sell)


I'm too literal! When I read the previous statement, I try to imagine ONE
sold item that is (simultaneously) "ten different models". Can I assume you
mean a [sold item] is one of the models in a table that lists equipment?

under
the descriptive info about that item, it would be most efficient. This
information will also be stored in an "Items Sold" table that is indexed
by
the type of purchaser (reseller, commercial, or employee).


"Indexed" has a different meaning in Access. Do you mean "sorted by"?

The data will be
used to generate a report (dynamically) and then the table (and report)
deleted from the database programmatically.


Whoa! If you are keeping informationa about what you sell, why would you
delete the table? Are you saying that you are creating a temporary table
solely for the purpose of generating a report? If so, be aware that any
queries you use to create that (temporary) table could be used instead as
the source of data for the report ... no deleting required!

Since I've performed dynamic
report generation and maintenance functions before, I don't expect to have
too much trouble with those. In fact, I can currently generate the data I
need using a crosstab query, but as stated before, it's a dumb query that
is
only good for display purposes.


There's no reason you couldn't use that crosstab query as the source for a
report.

The easiest fix that I can see would be to
find a way to use the crosstab; I've tried everything I can think of
except
exporting it to excel & re-importing as a table.
Hope this helps.


Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:17 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.