Re: deleting columns in table



Yes but how choose empty column using query?

"Douglas J. Steele" wrote:

All you need is two queries, no code at all.

To delete the contents of the temp table, you need a Delete query:

DELETE * FROM TempTable

To repopulate the temp table with data from an existing table, you need an
INSERT INTO query:

INSERT INTO TempTable (Field1, Field2, Field3, ...)
SELECT Field1, Field2, Field3, ...
FROM MyTable

If there's data in MyTable that you don't want inserted into the temp table,
put an appropriate WHERE clause.

In general, any time you have to choose between using code and using a query
to do the same thing, always choose the query.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"witek84@xxxxxxxxx" <witek84gmailcom@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:89EE5839-43D0-4014-8E24-2D5D2BC960B0@xxxxxxxxxxxxxxxx
I want to delete in macro empty columns.
I've got 2 queries. First deleting all data in temp table. Second serch
all
records in table that have minimum one cell with data. that query put data
into temp table. But not every colums have data. I want that my macro
check
column and if in column we don't have data then will delete. I've creating
macros only in excel and Í don't know how write this macro. I know only
this:

dim val as integer

for x=1 to 10 'I have 10 columns in table
val=0
for y=1 to eof 'how is end of records in file in access??
if cells(x,y)<>empty then 'in excel I'm using cells I don't
know
in access is that same
val=val+1
end if
next j
if val<>0 then
'and now I want to delete column x
end if
next i

Thanks






.



Relevant Pages

  • Re: deleting columns in table
    ... Doug Steele, Microsoft Access MVP ... To delete the contents of the temp table, you need a Delete query: ... To repopulate the temp table with data from an existing table, ... I want that my macro ...
    (microsoft.public.access.modulesdaovba)
  • Re: Informix vs Oracle vs DB2. SQL Query optimization.
    ... but I think you're confused because you don't know Oracle. ... the query chooses to limit TAB_A by the col_id. ... initially we have the collection as geo1. ... case of 270,000 rows in the collection, and 60,000 rows in the temp ...
    (comp.databases.informix)
  • Re: Relationships, back end
    ... query the same, using the linked file directly rather than a temp table. ... |> into tblMovements but into a temp table, ... | adds the EquipmentID field the the temp table". ...
    (microsoft.public.access.tablesdbdesign)
  • Re: deleting columns in table
    ... All you need is two queries, ... To delete the contents of the temp table, you need a Delete query: ... I want that my macro ...
    (microsoft.public.access.modulesdaovba)
  • Re: Truncation Issue w/ Strings
    ... I was getting the results from an access query, so I ended up having to ... create a temp table, and insert the rows into a memo field in the temp ... "fdhsjak hfdjksh fdshfjkdlsh fjdshfj hdslfh dshfjlshjfhdsjflhdsjlfh ... dsjlkhfjdshfjdha jfdhj f " & _ ...
    (microsoft.public.vb.general.discussion)