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

SQL code to input data in field based on data from another table

Status
Not open for further replies.

troyster

Technical User
Jan 18, 2002
10
US
We have a need to place a character "X" in a field of a relationshiped table based on a field in another table being "not null", this is to occur for several fields and to be updated upon command. We are using Access 2002, what would be the SQL code for something like this?
 
Not sure if this will work in 2002 but the basic SQL should look kinda like this

UPDATE TBL1 INNER JOIN TBL2 ON recid= TBL1.recID SET tbl1 = "x" WHERE isnull(tbl2.field)

I would think you could do it fairly easily using the QBE grid and an update query. Just add the 2 tables add the field you want to be null set the criteria to is null then add the field you want to update type "x" in the update area
good luck
 
Got it!! This helps a great deal. Terry Broadbent tried to give me this, however I misunderstood him... sorry Terry but I really appreciate your help... now it's working.
Thanks guys... not sure what we would do without these forums to help one another.
 
OOPS!! I have the query running now, however I find that I am having to make a new Update query for each field and I have 43 fields to have an "X" placed for data in the prime database, how do I create these in a single query, I have tried adding to the SQL window for more fields and keep getting syntax error messages. Anyone know how I should go about this?
Thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top