Change IFF to IIF.
UPDATE IPData INNER JOIN IPCData ON IPData.IP = IPCData.IP
SET IPData.tblClosets =
IIF(Nz(IPCData.WCloset)="",IPData.WCloset,IPCData.WCloset),
SET IPData.SWTag =
IIF(Nz(IPCData.SWTag)="",IPData.SWTag,IPCData.SWTag),
SET IPData.SWPrt =
IIF(Nz(IPCData.SWPrt)="",IPData.SWPrt,IPCData.SWPrt),
SET IPData.PtchPnl =
IIF(Nz(IPCData.PtchPnl)="",IPData.PtchPnl,IPCData.PtchPnl),
SET IPData.PtchPrt =
IIF(Nz(IPCData.PtchPrt)="",IPData.WCloset,IPCData.PtchPrt),
SET IPData.Mac =
IIF(Nz(IPCData.MAC)="",IPData.MAC,IPCData.MAC),
SET IPData.Dept =
IIF(Nz(IPCData.Dept)="",IPData.Dept,IPCData.Dept),
SET IPData.[Position] =
IIF(Nz(IPCData.Positon)="",IPData.Position,IPCData.Positon),
SET IPData.[User] =
IIF(Nz(IPCData.User)="",IPData.User,IPCData.User),
SET IPData.UserID =
IIF(Nz(IPCData.UserID)="",IPData.UserID,IPCData.UserID),
SET IPData.VLan =
IIF(Nz(IPCData.VLan)="",IPData.VLan,IPCData.VLan),
SET IPData.IP =
IIF(Nz(IPCData.IP)="",IPData.IP,IPCData.IP)
WHERE (((IPCData.Date)=Date()));
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
I changed the code this is what I have now and it gives me an error
Syntax
Error on Update
UPDATE IPData INNER JOIN IPCData ON IPData.IP = IPCData.IP
SET IPData.tblClosets =
iff(Nz(IPCData.WCloset)="",IPData.WCloset,IPCData.WCloset),
SET IPData.SWTag =
iff(Nz(IPCData.SWTag)="",IPData.SWTag,IPCData.SWTag),
SET IPData.SWPrt =iff(Nz(IPCData.SWPrt)="",IPData.SWPrt,IPCData.SWPrt),
SET IPData.PtchPnl =
iff(Nz(IPCData.PtchPnl)="",IPData.PtchPnl,IPCData.PtchPnl),
SET IPData.PtchPrt =
iff(Nz(IPCData.PtchPrt)="",IPData.WCloset,IPCData.PtchPrt),
SET IPData.Mac = iff(Nz(IPCData.MAC)="",IPData.MAC,IPCData.MAC),
SET IPData.Dept = iff(Nz(IPCData.Dept)="",IPData.Dept,IPCData.Dept),
SET IPData.[Position] =
iff(Nz(IPCData.Positon)="",IPData.Position,IPCData.Positon),
SET IPData.[User] = iff(Nz(IPCData.User)="",IPData.User,IPCData.User),
SET IPData.UserID =
iff(Nz(IPCData.UserID)="",IPData.UserID,IPCData.UserID),
SET IPData.VLan = iff(Nz(IPCData.VLan)="",IPData.VLan,IPCData.VLan),
SET IPData.IP = iff(Nz(IPCData.IP)="",IPData.IP,IPCData.IP)
WHERE (((IPCData.Date)=Date()));
:
Hi Michelle
The update query you need to use will take the form...
update IPData inner join IPCData on IPData.IP = IPCData.IP
Set IPData.Mac = ... ,
Set IPData.User = ... ,
etc
The Set's will all be the same format so I'll just use Mac as an
example.
If the blanks in IPCData are all Nulls (and not empty strings ie "")
then
you can use the following...
Set IPData.Mac = Nz(IPCData.Mac, IPData.Mac)
If the blanks could be Nulls or empty strings then use...
Set IPData.Mac = iif(Nz(IPCData.Mac) = "", IPData.Mac, IPCData.Mac)
Regards
Andy Hull
:
I have a form that keeps track of updates made to another table.
However
what I would like is to update the other table with the changes.
Example
I have 1 table called IP Data and 1 called IPCData
I have 10 fields in each table and sometimes only one of the 10
fields
gets
updated how whould I be able to tell the query to only update that
data
in
IPData if there is data in IPCData.
IPData
IP MAC User
Internet
SWPrt
1.1.1.1 00-00-00-00-00 jsmith no
5-2
1.1.1.2 00-00-00-00-01 bsmith yes
1-20
IPCData
IP MAC User
Internet
SWPrt
1.1.1.1 dsmith
yes
1.1.1.2 00-00-00-00-07
1-7
after I run the updat the IPDat should look like this....
IP MAC User
Internet
SWPrt
1.1.1.1 00-00-00-00-00 dsmith yes
5-2
1.1.1.2 00-00-00-00-07 bsmith yes
1-7
right now I am getting this as results
IP MAC User
Internet
SWPrt
1.1.1.1 dsmith
yes
1.1.1.2 00-00-00-00-07
1-7