access update query ignore nulls

M

mwilliams4

I have an update query that updates two fields in my database.
I use a temp table so the users can enter data all day, and then come
back to it later and add to it.

Then once the user wants to update in batch, an update query is run to
update the fields in the related records.

But sometimes one field of the two in the temp table has no data, and
I don't want to overwrite what may already be in that field with
nothing.

Is there a way to do it where if the field in the temp table has
nothing in it that it does not get updated.


Example

Rec ID invoiceDate InvoiceAmt
12345678 1/1/2008
12345432 $123.23
12345321 1/1/2008 $223.43

It would just update the invoiceDate for the first one,
just the Invoice Amount for the second,
and both fields on the third one.

It would seem to be an easy one, but I'm stuck.
Any help would be appreciated
 
M

mwilliams4

my actual SQL query is:

UPDATE LocInv INNER JOIN tblvins ON LocInv.last8 = tblvins.LAST8 SET
tblvins.[INV DATE] = locinv.[invoice date], tblvins.[SALES CST] =
locinv.invamt;

LocInv isd the local table
tblVins is the main table
 
M

Michael Gramelspacher

my actual SQL query is:

UPDATE LocInv INNER JOIN tblvins ON LocInv.last8 = tblvins.LAST8 SET
tblvins.[INV DATE] = locinv.[invoice date], tblvins.[SALES CST] =
locinv.invamt;

LocInv isd the local table
tblVins is the main table

UPDATE Locinv
INNER JOIN TblvIns
ON Locinv.Last8 = TblvIns.Last8
SET TblvIns.[Inv Date] = IIF(TblvIns.[Inv Date] IS NULL,Locinv.[Invoice
Date], TblvIns.[Inv Date]),
TblvIns.[Sales cst] = IIF(TblvIns.[Sales cst] IS NULL,Locinv.InvAmt,
TblvIns.[Sales cst]);
 

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

Similar Threads

How to extract the year from a date Field 4
Update Query Help *urgent* 0
DSum update query with multiple fields 0
Update Nulls to N/A 2
update query 2
Update query 4
Previous Date Query 5
Update Query 4

Top