Share via

Append

Anonymous
2024-11-05T20:36:04+00:00

Let's say that I have a table called [TBL] that has a yes/no fields called [Submitted], what I need to do is insert a checkmark in the [Submitted] field after [TBLQ] query is downloaded. Within in a form, I added a control to run the macro below. The macro downloads the [TBLQ] query results, but that's where it ends. The macro also runs an append query (or will), but I do not know how to tell the appends query to add a checkmark to [TBL] that doesn't exist. Am I making sense?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2024-11-07T00:36:38+00:00

When I ran the update query, I expected ID 1,4, and 6 to be set to TRUE.

That’s what I’d expect.  You didn’t by any chance write the query as:

UPDATE TBL

SET TBL.Submitted = TRUE

WHERE EXISTS

    (SELECT *

     FROM TBLQ

     WHERE TBLQ.ID = TBLQ.ID);

Another method would be:

UPDATE TBL

SET TBL.Submitted = TRUE

WHERE ID IN

    (SELECT ID

     FROM TBLQ);

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

15 additional answers

Sort by: Most helpful
  1. Anonymous
    2024-11-05T23:18:26+00:00

    You probably need something like this:

    UPDATE TBL INNER JOIN TBLQ

    ON TBL.AccountNumber = TBLQ.AcountNumber

    SET TBL.Submitted = TRUE;

    By virtue of the INNER JOIN only those rows in TBL which have a match in TBLQ will be updated.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-11-05T21:35:32+00:00

    Gotcha, update not append. One more twist, though: The TBLQ query results will list only a few records, so not all records in the TBL table will be updated to true. So I need to include criteria to the update query. Something like: if TBLQ query [AccountNumber] Is Not Null, then set the submitted field in TBL to true. I tried joining TBLQ to TBL in the update query, but it spins off an error.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-11-05T20:49:19+00:00

    You are confusing an interface element, i.e., the Checkmark, with the value in the field, which is a Boolean. Booleans can have one of two possible values: True or False. In some implementations, the True value can be displayed as a filled in Checkmark , as "Yes", or even as some other token. The False value can be displayed as an unfilled in Checkmark, as "No" and so on. Fundamentally, True, in Access is the number -1, whereas False is the number 0. All else is an interface display element.

    You don't need to add "a checkmark". As Scott pointed out, you need to set the field's value to true.

    Was this answer helpful?

    0 comments No comments
  4. ScottGem 68,830 Reputation points Volunteer Moderator
    2024-11-05T20:38:22+00:00

    You need an UPDATE query.

    UPDATE table SET field = True;

    Was this answer helpful?

    0 comments No comments