change the yes/no value in a table

J

JattilaB

I am trying to set the yes/no value on a record in a table ...
if is true the set it to false


how can I achieve this using VB in access

currently this is my code

ProRecords = DCount("[ProID]", "Procedure")
Set db = CurrentDb()

Set rst = db.OpenRecordset("Select * from [Procedure];")
ProVar = rst.GetRows(ProRecords)

Do Until r = ProRecords

If ProVar(7, r) = True Then



any help would be appreciated...
 
S

Steve Schapel

Jattila,

The easiest way to do this is by using an Update Query:
- Make a query in design view based on your Procedure table
- add the ProVar field to the query design grid
- select Update from the Query menu
- in the Update To row of the grod, put 0
- run the query

The SQL of the query will look like...
UPDATE Procedure SET ProVar = 0;

If you want to use a macro to make it happen, use the OpenQuery macro
action. If you want to use a VBA procedure to make it happen, you can
simply do this...
CurrentDb.Execute "UPDATE Procedure SET ProVar = 0"
 

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