How code this update query?

G

Guest

I am importing some data into my access database (access 2000). The data
contains about 50 columns with a status and a date, this represents status
history. There is also a column for 'current status and a date'. What I need
to do is to move this current status and date into the correct column in the
most efficient way possible. So far I have "UPDATE tblImport..... WHERE
NZ(Current_Status) <> 0;".
Now how do I test the current status field and perform the correct column
updates? Can I use a CASE statement? I do know that certain statuses are much
more common that others so a way of doing the tests that takes advantage of
this would be good.
 
C

Chris2

mscertified said:
I am importing some data into my access database (access 2000). The data
contains about 50 columns with a status and a date,

mscertified,

Is that 50 columns AND status and date columns. Or 50 columns of
Status1, Date1, Status2, Date2, etc.?

this represents status
history. There is also a column for 'current status and a date'. What I need
to do is to move this current status and date into the correct column in the
most efficient way possible. So far I have "UPDATE tblImport..... WHERE
NZ(Current_Status) <> 0;".

It is my personal preference to always specify the <return-value>
for Nz, instead of leaving it out.

Now how do I test the current status field and perform the correct column
updates?

Looks like you have the syntax of UPDATE worked out.

Can I use a CASE statement?

No CASE, sorry. Use SWITCH(), instead.

Switch(expr-1, value-1[, expr-2, value-2 … [, expr-n,value-n]])

<expr> Required. Variant expression you want to evaluate.
<value> Required. Value or expression to be returned if the
corresponding expression is True.


Sincerely,

Chris O.
 

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