Yes/No

D

Daniel

I have a table with a field named item. I also have a field in the same
table named radios with YES/NO value that was just added. I have hundreds
of radios in this database along with thousands of other records of
inventory. I need a way to have a command check the value of item and if it
= "RADIO" then set the value of radios = YES. I can do this for individual
records, but I want to do it for the whole table at the same time. Can
anyone help.

Thanks,

Daniel
 
C

Cheryl Fischer

Here is some code that will update your Radios field - presuming that Radios
is a Yes/No field (not text)

Dim strSQL As String

strSQL = "UPDATE [MyTable] SET [MyTable].Radios = -1 " _
& "WHERE [MyTable].Item = " & Chr(34) & "RADIO" & Chr(34)

CurrentDb.Execute strSQL, dbFailOnError

hth,
 
D

Daniel

Thank You!!!

Daniel


Cheryl Fischer said:
Here is some code that will update your Radios field - presuming that Radios
is a Yes/No field (not text)

Dim strSQL As String

strSQL = "UPDATE [MyTable] SET [MyTable].Radios = -1 " _
& "WHERE [MyTable].Item = " & Chr(34) & "RADIO" & Chr(34)

CurrentDb.Execute strSQL, dbFailOnError

hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Daniel said:
I have a table with a field named item. I also have a field in the same
table named radios with YES/NO value that was just added. I have hundreds
of radios in this database along with thousands of other records of
inventory. I need a way to have a command check the value of item and
if
it
= "RADIO" then set the value of radios = YES. I can do this for individual
records, but I want to do it for the whole table at the same time. Can
anyone help.

Thanks,

Daniel
 
B

Bruce M. Thompson

I have a table with a field named item. I also have a field in the same
table named radios with YES/NO value that was just added. I have hundreds
of radios in this database along with thousands of other records of
inventory. I need a way to have a command check the value of item and if it
= "RADIO" then set the value of radios = YES. I can do this for individual
records, but I want to do it for the whole table at the same time. Can
anyone help.

You can also eliminate that extra field by using a calculated control/field in
any query, form and/or report. In a query, try adding a new column:

IsRadio: IIF([item] = "RADIO", "YES", "")

You can then place a textbox on a form/report based on this "field".

To apply this technique directly in an unbound textbox on a form or report, use
the following in the textbox's "Control Source" property:

=IIF([item] = "RADIO", "YES", "")
 

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