Yes/No buttons (follow-up to my previous question on this)

S

Stephen Glynn

How do I use a Yes/No button on a form to set the Yes/No value of a
specific record in a table? I've got several of these buttons which
I'll need to place on a single form. When the operator has checked the
relevant buttons I want to run an append query to add the record IDs of
the selected records to another table. Then I'll run an update query
to reset all the values in the source table to No.

Steve
 
S

Stephen Glynn

Stephen Glynn wrote:

Answered my own question (I think):

SELECT tblMyTable.ItemID
FROM tblMyTable
WHERE (((tblMyTable.ItemID)=1)) and [Forms]![MyForm]![Check1]=True
OR
(((tblMyTable.ItemID)=2)) and [Forms]![MyForm]![Check2]=True;

and then as many more OR clauses as I need.

Steve
 
T

tina

i'm thinking that's not going to work, but i'm not clear on what your table
structures. is your source table multiple records, with one ID field and one
Yes/No field? and does your "other" table have the same structure? and do
you want to append only the checkmarked records from the source table into
the other table? and then reset all the source table records to "unchecked"?
if so, your append query would be something like:

INSERT INTO OtherTableName ( CheckBoxField, ItemID, AddlField )
SELECT CheckboxField, ItemID, AddlField
FROM SourceTableName
WHERE SourceTableName.CheckboxField = True;

your update query to reset the source table records would be something like:

UPDATE SourceTableName SET CheckboxField = False;

hth


Stephen Glynn said:
Stephen Glynn wrote:

Answered my own question (I think):

SELECT tblMyTable.ItemID
FROM tblMyTable
WHERE (((tblMyTable.ItemID)=1)) and [Forms]![MyForm]![Check1]=True
OR
(((tblMyTable.ItemID)=2)) and [Forms]![MyForm]![Check2]=True;

and then as many more OR clauses as I need.

Steve
How do I use a Yes/No button on a form to set the Yes/No value of a
specific record in a table? I've got several of these buttons which
I'll need to place on a single form. When the operator has checked the
relevant buttons I want to run an append query to add the record IDs of
the selected records to another table. Then I'll run an update query
to reset all the values in the source table to No.

Steve
 
S

Stephen Glynn

Sorry, I'd not made myself clear. I was trying not to have a yes/no
field in the underlying table from which I was taking my values.
That's because I need to drop the check boxes individually all over the
form. As you'll see from the other thread ("Yes/No boxes in forms" I'm
having trouble doing it in VB using the tag property.

Steve
i'm thinking that's not going to work, but i'm not clear on what your table
structures. is your source table multiple records, with one ID field and one
Yes/No field? and does your "other" table have the same structure? and do
you want to append only the checkmarked records from the source table into
the other table? and then reset all the source table records to "unchecked"?
if so, your append query would be something like:

INSERT INTO OtherTableName ( CheckBoxField, ItemID, AddlField )
SELECT CheckboxField, ItemID, AddlField
FROM SourceTableName
WHERE SourceTableName.CheckboxField = True;

your update query to reset the source table records would be something like:

UPDATE SourceTableName SET CheckboxField = False;

hth


Stephen Glynn wrote:

Answered my own question (I think):

SELECT tblMyTable.ItemID
FROM tblMyTable
WHERE (((tblMyTable.ItemID)=1)) and [Forms]![MyForm]![Check1]=True
OR
(((tblMyTable.ItemID)=2)) and [Forms]![MyForm]![Check2]=True;

and then as many more OR clauses as I need.

Steve

How do I use a Yes/No button on a form to set the Yes/No value of a
specific record in a table? I've got several of these buttons which
I'll need to place on a single form. When the operator has checked the
relevant buttons I want to run an append query to add the record IDs of
the selected records to another table. Then I'll run an update query
to reset all the values in the source table to No.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top