Check Box triggers Toggle Button

S

Sondra

I have a form that contains a check box to obsolete a
document. Also associated with the document are several
individual toggle buttons which identify the binders these
documents are in. If the button = yes then the document
is in the binder.

I was trying to write an expression that stated if the
check box = yes then the toggle button should equal no. I
wrote it like this and placed in on the AfterUpdate Event
for each toggle button:

Iif([ObsoleteDoc]= yes, no, yes)

But it isn't working.

1. Do I need to identify the name of the toggle button in
my Iif statement?
2. Is this possible?

Thanks
 
S

Steve Schapel

Sondra,

On the After Update event of the obsolete checkbox, put code equivalent
to...

If Me.ObsoleteDoc Then
Me.YourBinderToggle = 0
End If
 
S

Sondra

Steve:

So don't use the Iif Expression and only use the module
defined below?

But how do I write it for multiple binders? Like this?
If Me.ObsoleteDoc Then
Me.YourBinderToggle = 0
Me.YourBinder2Toggle = 0
Me.YourBinder2Toggle = 0
End If

Thanks
-----Original Message-----
Sondra,

On the After Update event of the obsolete checkbox, put code equivalent
to...

If Me.ObsoleteDoc Then
Me.YourBinderToggle = 0
End If

--
Steve Schapel, Microsoft Access MVP

I have a form that contains a check box to obsolete a
document. Also associated with the document are several
individual toggle buttons which identify the binders these
documents are in. If the button = yes then the document
is in the binder.

I was trying to write an expression that stated if the
check box = yes then the toggle button should equal no. I
wrote it like this and placed in on the AfterUpdate Event
for each toggle button:

Iif([ObsoleteDoc]= yes, no, yes)

But it isn't working.

1. Do I need to identify the name of the toggle button in
my Iif statement?
2. Is this possible?

Thanks
.
 
S

Steve Schapel

Sondra,

Yes, that is correct.

IIf() is a function. Its purpose is to *return* a value, based on the
*evaluation* of other values. What you want to do is *assign* a value
based on an *examination* of another value... an entirely different concept.

The code I gave in my example assumes that you only want to manipulate
the toggle button(s) in response to the ObsoleteDoc checkbox getting
ticked. As it stands, un-ticking ObsoleteDoc will not do anything.
 
S

Sondra

Steve:

Okay here is how I wrote it:

Private Sub ObsoleteDocument_AfterUpdate()

If Me.ObsoleteDocument Then
Me.DistONE = 0
Me.DistTWO = 0
Me.DistTHREE = 0
Me.DistFOUR = 0
Me.DistFIVE = 0
End If

End Sub

:( Not working. I go into the form to make the document
obsolete and it won't let me mark the [ObsoleteDocument]
check box.

Any further advise.

-----Original Message-----
 
S

Steve Schapel

Sondra,

I can't see how the code you have used can have anything to do with the
problem. To test, you can temporarily remove or comment out the code...
but I would expect that the checkbox will still show the same behaviour.

Is the form based on a query? Is the ObsoleteDocument field in the
query? Is it a Yes/No data type? If you open the query (or table)
directly, can you edit the ObsoleteDocument field in the query (or
table) datasheet? Can you edit the data in other controls on the form?
Is the AllowEdits property of the form set to Yes?
 
S

Sondra

Steve:

Sorry for the confusion. Your right it doesn't have
anything to do with the code. I just opened the wrong
form when writing the code and therefore it is my fault.
Now that I have corrected the problem and used the right
form, it works great.

Thanks so much.
-----Original Message-----
Sondra,

I can't see how the code you have used can have anything to do with the
problem. To test, you can temporarily remove or comment out the code...
but I would expect that the checkbox will still show the same behaviour.

Is the form based on a query? Is the ObsoleteDocument field in the
query? Is it a Yes/No data type? If you open the query (or table)
directly, can you edit the ObsoleteDocument field in the query (or
table) datasheet? Can you edit the data in other controls on the form?
Is the AllowEdits property of the form set to Yes?

--
Steve Schapel, Microsoft Access MVP
Steve:

Okay here is how I wrote it:

Private Sub ObsoleteDocument_AfterUpdate()

If Me.ObsoleteDocument Then
Me.DistONE = 0
Me.DistTWO = 0
Me.DistTHREE = 0
Me.DistFOUR = 0
Me.DistFIVE = 0
End If

End Sub

:( Not working. I go into the form to make the document
obsolete and it won't let me mark the [ObsoleteDocument]
check box.

Any further advise.
.
 
S

Sondra

I wrote my code as stated:
Private Sub chkObsolete_AfterUpdate()

If Me.Obsolete Then
Me.togMASTER = 0
Me.togIDTSS = 0
Me.togIDCOL = 0
Me.togIDOPs = 0
Me.togIDDnrS = 0
Me.togCOLeBinder = 0
Me.togBOISS = 0
Me.togTFSS = 0
Me.togEDCF = 0
Me.togIDCOLTrain = 0
Me.togUTCFF = 0
Me.togUTAPH = 0
Me.togUTCS = 0
Me.togMEDDIR = 0
Me.togutcoltrn = 0
Me.togGF = 0
Me.togMSRR = 0
Me.togMISARCTRN = 0
Me.togMISBSD = 0
Me.togMIS3017f = 0
Me.togMIS3031ja = 0
Me.togMIS3031F = 0
Me.togMIS3051ja = 0
Me.togMISSys3 = 0
Me.togmissys14 = 0
Me.togMIS3034F = 0
Me.togMIS3031ja = 0
Me.togmissys8 = 0
End If
End Sub

But it is not working. None of the toggle buttons
become "NO" when they are currently marked "YES".

Please advise.
-----Original Message-----
Steve:

So don't use the Iif Expression and only use the module
defined below?

But how do I write it for multiple binders? Like this?
If Me.ObsoleteDoc Then
Me.YourBinderToggle = 0
Me.YourBinder2Toggle = 0
Me.YourBinder2Toggle = 0
End If

Thanks
-----Original Message-----
Sondra,

On the After Update event of the obsolete checkbox, put code equivalent
to...

If Me.ObsoleteDoc Then
Me.YourBinderToggle = 0
End If

--
Steve Schapel, Microsoft Access MVP

I have a form that contains a check box to obsolete a
document. Also associated with the document are several
individual toggle buttons which identify the binders these
documents are in. If the button = yes then the document
is in the binder.

I was trying to write an expression that stated if the
check box = yes then the toggle button should equal no. I
wrote it like this and placed in on the AfterUpdate Event
for each toggle button:

Iif([ObsoleteDoc]= yes, no, yes)

But it isn't working.

1. Do I need to identify the name of the toggle
button
.
 
S

Steve Schapel

Sondra,

There is an inconsistency here. It looks like the obsolete control is
called chkObsolete whereas the code refers to Me.Obsolete. Maybe is
should be...

If Me.chkObsolete Then
...

--
Steve Schapel, Microsoft Access MVP
I wrote my code as stated:
Private Sub chkObsolete_AfterUpdate()

If Me.Obsolete Then
Me.togMASTER = 0
Me.togIDTSS = 0
Me.togIDCOL = 0
Me.togIDOPs = 0
Me.togIDDnrS = 0
Me.togCOLeBinder = 0
Me.togBOISS = 0
Me.togTFSS = 0
Me.togEDCF = 0
Me.togIDCOLTrain = 0
Me.togUTCFF = 0
Me.togUTAPH = 0
Me.togUTCS = 0
Me.togMEDDIR = 0
Me.togutcoltrn = 0
Me.togGF = 0
Me.togMSRR = 0
Me.togMISARCTRN = 0
Me.togMISBSD = 0
Me.togMIS3017f = 0
Me.togMIS3031ja = 0
Me.togMIS3031F = 0
Me.togMIS3051ja = 0
Me.togMISSys3 = 0
Me.togmissys14 = 0
Me.togMIS3034F = 0
Me.togMIS3031ja = 0
Me.togmissys8 = 0
End If
End Sub

But it is not working. None of the toggle buttons
become "NO" when they are currently marked "YES".

Please advise.

-----Original Message-----
Steve:

So don't use the Iif Expression and only use the module
defined below?

But how do I write it for multiple binders? Like this?
If Me.ObsoleteDoc Then
Me.YourBinderToggle = 0
Me.YourBinder2Toggle = 0
Me.YourBinder2Toggle = 0
End If

Thanks

-----Original Message-----
Sondra,

On the After Update event of the obsolete checkbox, put

code equivalent
to...

If Me.ObsoleteDoc Then
Me.YourBinderToggle = 0
End If

--
Steve Schapel, Microsoft Access MVP


Sondra wrote:

I have a form that contains a check box to obsolete a
document. Also associated with the document are
several

individual toggle buttons which identify the binders
these

documents are in. If the button = yes then the
document

is in the binder.

I was trying to write an expression that stated if the
check box = yes then the toggle button should equal

no. I
wrote it like this and placed in on the AfterUpdate
Event

for each toggle button:

Iif([ObsoleteDoc]= yes, no, yes)

But it isn't working.

1. Do I need to identify the name of the toggle
button
in

my Iif statement?
2. Is this possible?

Thanks

.

.
 

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