Should be simple: Click a button, all checkboxes become selected in a table

Interesting Select code, but your problems were associated with the UPDATE query.

In plain English what exactly do you want Updated and what are the relevant criteria?
 
OK, In my "Listings" table, I have a checkbox [Lot_Selected] which I want to be checked in all records if the checkbox on the form [Check124] matches the value of a checkbox [Garage] in table "Houses". (This is all executed on the click of Command120)

The "Listings" table and "Houses" table are linked. I guess I really don't need the "Models" table in the join command for this query.
 
Last edited:
Code:
strSQL = "
UPDATE Listings 
  INNER JOIN Houses 
  ON Listings.Lot_ID = Houses.Lot_ID 
  SET [Lot_Selected] = -1
  Where [Garage] = " & Me.Check124
CurrentDb.Execute strSQL, dbFailOnError

I think that's probably close, but I'm getting an expected end of statement error.

yup:
Code:
strSQL = "Update Listings INNER JOIN Houses ON Listings.Lot_ID = Houses.Lot_ID Set [Lot_Selected] = -1 Where [Garage] = " & Me.Check124
CurrentDb.Execute strSQL, dbFailOnError

Works perfectly.

Thanks everyone! Now I need to take these selected [Lot_Selected] and filter them into 2 sub forms! Fun!
 
Last edited:
Thanks everyone! Now I need to take these selected [Lot_Selected] and filter them into 2 sub forms! Fun!

My 2 cents here is a bit off the original topic, but still relevant because table structure plays the major role in determining how difficult the rest of your application design (queries, forms, reports) is going to be as far as getting the output you want.

Maybe part of the reason you're having all this "fun" is because you've got some issues with table structure. If you are still at or near the beginning stages of application design, you might want to at least consider re-thinking the table structure. If you're too far into development, or if it's an app you didn't design and/or don't have control over, then you might just be stuck with coming up with kludges to get the output you want.
 

Users who are viewing this thread

Back
Top Bottom