Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Skip a portion of an UPDATE QUERY

Status
Not open for further replies.

williekay

Technical User
Jun 30, 2003
121
US
SQL$ = "UPDATE CIDtbl SET [" & Me.Parent![1] & "] = " & Me.Parent![elm1] & ",[" & Me.Parent![1] & "] = " & Me.Parent![elm1] & " WHERE ([CIDtbl].ID = " & Me!ID & ")"

Let's say that the preceeding gives me

UPDATE CIDtbl SET [] = 0, [Mo] = .15 WHERE ([CIDtbl].ID = 137 )

Is there a way to say

If this [" & Me.Parent![1] & "] equals [] skip [" & Me.Parent![1] & "] = " & Me.Parent![elm1] & " portion of SQL$ so it reads

UPDATE CIDtbl SET [Mo] = .15 WHERE ([CIDtbl].ID = )

ps- even if it reads UPDATE CIDtbl SET [] = 75, [Mo] = .15 WHERE ([CIDtbl].ID = 137 ) I want it to skip the portion because it's not listing a field name.



Willie
 
Something like:
Code:
SQL$ = "UPDATE CIDtbl SET " & Iif(Len(Me.Parent![1])>0,"[" & Me.Parent![1] & "] = " & Me.Parent![elm1] & ",") & "[" & Me.Parent![1] & "] = " & Me.Parent![elm1] & " WHERE ([CIDtbl].ID = " & Me!ID & ")"
Untested though, so proceed with caution ;-)

[pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top