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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Query...easy for you...

Status
Not open for further replies.

BullHalseyUSN

Technical User
Aug 28, 2003
72
US
tough for me!

Greetings Friends,

I have a tblSailors where every member is part of a Dept. tblDept is related to the former by a foreign key in tblSailor, DeptID.

I am trying to make a "group update" feature that will assign a bunch of members to a given department.

My SQL is all "jacked up." What I would like it to say is,
"Update Dept ID based on what is in [Forms]![frmGroupUpdate]!Combo69.

Here is the blather that I've come up with, and it doesn't work, but it does update with a wrong value so I'm onto something. The ?'s are because I don't know what those operators do. :)

UPDATE tblSailors SET tblSailors.DeptId = IIf([Forms]![frmGroupUpdate]!Combo69=True,?,[?])
WHERE (((tblSailors.GroupUpdate)=True));

Thanks for any help. BH
 
Sounds like you don't need the iif statement...something like this will suffice in place:

tblSailors.DeptId = [Forms]![frmGroupUpdate]!Combo69

Unless I'm wrong, combo69 will return the department ID you want. Basically the iif statement is iif(formula, what to do if the formula is true, what to do if the formula is false). Hope that helps.

Kevin
 
That's what I thought, dawgs, but it seems to update all of my records. Not just the guys I want. I will see if it works! tks.
 
Hi, you might try something like this.

UPDATE tblSailors SET tblSailors.deptID = Forms!frmGroupUpdate!Combo69
WHERE (([tblSailors]![Sailor]="Jim"));

You still have identify which sailors you want to update. In this case, everyone named 'Jim'.

Hope that helps.
-USS Paul F. Foster DD-964 - 6 years.
 
Sailor (officer/midshipman :)),

Thanks for the guidance.

I'll take a look and see if that fixes her.

BH
 
Good luck, hope that helps. If not, it should be easy to get worked out.

Oh, Sailor - GSM1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top