Dynamic generation of a table

M

Maracay

Hi guys

I have a table with several fields, some columns are empty, what I need is
to dynamically generate a table with the fields that at lease have 1 records.

Any help will be appreciated.

Thanks
 
J

John W. Vinson

Hi guys

I have a table with several fields, some columns are empty, what I need is
to dynamically generate a table with the fields that at lease have 1 records.

Any help will be appreciated.

Thanks

I'm not understanding. All "fields" have at least 1 record, since a field
cannot exist except WITHIN a record.

Are you trying to create a new (redundant, containing the same data that you
already have) table just excluding those fields which are NULL in all records?
If so, your database structure is surely wrong; a Table's field should all
refer to attributes of whatever Entity is represented by the table.

Please explain the context - what kind of information does this table contain?
What are the fields (or some representative fields)? What will you do when you
have this redundant table?
 
T

Tony Toews [MVP]

Maracay said:
I have a table with several fields, some columns are empty,

So what if some columns are empty. Empty columns might take up a few
bytes per record but that's about it.
what I need is
to dynamically generate a table with the fields that at lease have 1 records.

Why? What is your objective?

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
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
M

Maracay

Hi Guy

Yes you are right; forget what I said before, I should start with what I
want to do.

I have a table with 20 fields, I use this fields to load data from excel to
this table, but the excel spread sheets are not always the same, because from
the 20 fields in my table usually 10 or 15 get data when I import the data,
depending on the sheet.



After the data is on the table, I do some processing and export the data
back to a comma delimited file using this instruction:



Private Sub ExportFile_Click()

Dim strFileName As String

strFileName = textLocationNameFileeXP



DoCmd.TransferText acExportDelim, , "tblPeople", strFileName, True





The problem is that let say just 7 columns are fill with data some times
from 1000 rows 1 of the columns has 1 or 2 records at the bottom of the file
some times the column is all full this are the columns I want to export from
the table, the other 13 are empty I don’t want to exports those empty
columns, the problems is that the comma delimited file has the columns with
data plus the headers of the columns without data.



My question, How can I export from the table the columns with at lease 1
line with data.



example



Table

Name Lastname Address Address2

-------------------------------------------------------

John Mayes 50 Albion Rd

Mary Chu

Carlos Manso



In this case I don’t want Address2 in the .CSV file because is empty in the
table. The comma delimited file should look like that.



Comma Delimited file

Name Lastname Address

--------------------------------------

John Mayes 50 Albion Rd

Mary Chu

Carlos Manso



Let me know If you guys have any other question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top