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  

update fields filled with spaces to nulls



 
 
Thread Tools Display Modes
  #1  
Old May 5th, 2004, 10:03 PM
dkingston
external usenet poster
 
Posts: n/a
Default update fields filled with spaces to nulls

i have several linked tables in access2002 that i use to
import data from an AS/400.
after i update the linked tables i append the data in them
to other tables.
when i import an "empty" field is is filled with spaces.
i am running update queries to update a field Like' *'
to Null.
currently i need a seperate update query for each field.
is there a way to check all fields in a table for all
spaces or all zeros and change the fields to Null?
many thanks for any help you can give me.
please reply via post or to:
d k i n g s t o n (at) j a g l y n n (dot) c o m

  #2  
Old May 6th, 2004, 01:46 AM
Jessestonecedar
external usenet poster
 
Posts: n/a
Default update fields filled with spaces to nulls

check using the 'iif' function in your update queries. You can define one for
each field and update all at once.
  #3  
Old May 7th, 2004, 06:04 AM
TC
external usenet poster
 
Posts: n/a
Default update fields filled with spaces to nulls

You realize that you can update many fields in a single Update statement?

UPDATE MyTable
SET ThisField = ...,
ThatField = ...,
TotherField = ...,
etc.

You could even write some code that would take a table name, find the text
fields in that table's structure, and create the UPDATE statement
programatically! If you want to investigate that idea, start with this:

(untested)

dim db as database, fld as field
set db = currentdb()
for each fld in db.tabledefs![MyTable].fields
debug.print fld.name, fld.type
next
set db=nothing

HTH,
TC


"dkingston" wrote in message
...
i have several linked tables in access2002 that i use to
import data from an AS/400.
after i update the linked tables i append the data in them
to other tables.
when i import an "empty" field is is filled with spaces.
i am running update queries to update a field Like' *'
to Null.
currently i need a seperate update query for each field.
is there a way to check all fields in a table for all
spaces or all zeros and change the fields to Null?
many thanks for any help you can give me.
please reply via post or to:
d k i n g s t o n (at) j a g l y n n (dot) c o m



 




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 06:09 PM.


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