Option Group Dilemma

B

Beeyen

Good Day,

The following is what I attempting to accomplish but my coding is a bit at
fault. Would someone be so kind as to look over the coding based on the
information I have provide. I would appreciate it very much. When I select
yes or no I received a Runtime error 2427 “ You entered an expression that
has no value†or You tried to assign a Null value to a variable that is not
a variant data type.

For Routing Exceptions Handling
If I select yes it enters the current date/time in a field called
ExceptionHandling,
If I select no exceptions it enters a grayed out field in a field called
ExceptionResolved

For Routing Exceptions Resolved
If I select Resolved it enters the current date/time in a field called
ExceptionResolved
If I select NotResolved it enters text which says ‘Exception not Resolved’

NEXT TO ROUTING EXCEPTIONS HANDLING
Option Button – YESEXCEPTIONBUTTON
Data - Option Value = 1
Event – On Got Focus button is as follows:

Private Sub YESEXCEPTIONBUTTON_GotFocus()
If Me.YESEXCEPTIONBUTTON = True Then
Me.[ExceptionsHandling] = Now()
Else
Me.[ExceptionsHandling] = Now()
Me.[Exceptions_Resolved] = ""
Me.[Exceptions_Resolved].Enabled = True

End If

End Sub


Option Button - NOEXCEPTIONBUTTON
Data – Option Value = 2
Event – On Got Focus
Event Procedure
Private Sub NOEXCEPTIONBUTTON_GotFocus()
If Me.NOEXCEPTIONBUTTON = True Then

Me.[Exceptions_Resolved].BackColor = 12632256
Else
Me.[Exceptions_Resolved].BackColor = 16777215

End If

End Sub

Other (Name) = YESEXCEPTIONBUTTON
******************************
NEXT TO THE EXCEPTION RESOLVED FIELD

Option Button - YESRESOLVEDBUTTON
Data – Option Value = 1
Event – On Got Focus
Event Procedure
If Me.Exceptionsyesbutton = -1 Then
Me.[Exceptions_Resolved] = Now()
End If

End Sub

OTHER (NAME) = YESRESOLVEDBUTTON
 
J

Jeanette Cunningham

Hi Beeyen,
Your code is using the values of the option buttons.
To use an option group, you use the value for the option group as a whole.

Private Sub OptionGroupName()
If Me.OptionGroupName = 1 Then
Me.[ExceptionsHandling] = Now()
ElseIf Me.OptionGroupName = 2 Then
Me.[Exceptions_Resolved].BackColor = 12632256
Else
End If
End Sub

Note: replace OptionGroupName with the name of your option group.
I haven't added all your code on the basis that you will be able to finish
this yourself.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

Jeanette Cunningham

Oops . . .
The first line of that code should be-->
Private Sub OptionGroupName_AfterUpdate()

If you look carefully, you can see that the first line from the previous
post is missing -->
_AfterUpdate


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Jeanette Cunningham said:
Hi Beeyen,
Your code is using the values of the option buttons.
To use an option group, you use the value for the option group as a whole.

Private Sub OptionGroupName()
If Me.OptionGroupName = 1 Then
Me.[ExceptionsHandling] = Now()
ElseIf Me.OptionGroupName = 2 Then
Me.[Exceptions_Resolved].BackColor = 12632256
Else
End If
End Sub

Note: replace OptionGroupName with the name of your option group.
I haven't added all your code on the basis that you will be able to finish
this yourself.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Beeyen said:
Good Day,

The following is what I attempting to accomplish but my coding is a bit
at
fault. Would someone be so kind as to look over the coding based on the
information I have provide. I would appreciate it very much. When I
select
yes or no I received a Runtime error 2427 " You entered an expression
that
has no value" or You tried to assign a Null value to a variable that is
not
a variant data type.

For Routing Exceptions Handling
If I select yes it enters the current date/time in a field called
ExceptionHandling,
If I select no exceptions it enters a grayed out field in a field called
ExceptionResolved

For Routing Exceptions Resolved
If I select Resolved it enters the current date/time in a field called
ExceptionResolved
If I select NotResolved it enters text which says 'Exception not
Resolved'

NEXT TO ROUTING EXCEPTIONS HANDLING
Option Button - YESEXCEPTIONBUTTON
Data - Option Value = 1
Event - On Got Focus button is as follows:

Private Sub YESEXCEPTIONBUTTON_GotFocus()
If Me.YESEXCEPTIONBUTTON = True Then
Me.[ExceptionsHandling] = Now()
Else
Me.[ExceptionsHandling] = Now()
Me.[Exceptions_Resolved] = ""
Me.[Exceptions_Resolved].Enabled = True

End If

End Sub


Option Button - NOEXCEPTIONBUTTON
Data - Option Value = 2
Event - On Got Focus
Event Procedure
Private Sub NOEXCEPTIONBUTTON_GotFocus()
If Me.NOEXCEPTIONBUTTON = True Then

Me.[Exceptions_Resolved].BackColor = 12632256
Else
Me.[Exceptions_Resolved].BackColor = 16777215

End If

End Sub

Other (Name) = YESEXCEPTIONBUTTON
******************************
NEXT TO THE EXCEPTION RESOLVED FIELD

Option Button - YESRESOLVEDBUTTON
Data - Option Value = 1
Event - On Got Focus
Event Procedure
If Me.Exceptionsyesbutton = -1 Then
Me.[Exceptions_Resolved] = Now()
End If

End Sub

OTHER (NAME) = YESRESOLVEDBUTTON
 
B

Beeyen

Very Good

Thank you much!

Jeanette Cunningham said:
Oops . . .
The first line of that code should be-->
Private Sub OptionGroupName_AfterUpdate()

If you look carefully, you can see that the first line from the previous
post is missing -->
_AfterUpdate


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Jeanette Cunningham said:
Hi Beeyen,
Your code is using the values of the option buttons.
To use an option group, you use the value for the option group as a whole.

Private Sub OptionGroupName()
If Me.OptionGroupName = 1 Then
Me.[ExceptionsHandling] = Now()
ElseIf Me.OptionGroupName = 2 Then
Me.[Exceptions_Resolved].BackColor = 12632256
Else
End If
End Sub

Note: replace OptionGroupName with the name of your option group.
I haven't added all your code on the basis that you will be able to finish
this yourself.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Beeyen said:
Good Day,

The following is what I attempting to accomplish but my coding is a bit
at
fault. Would someone be so kind as to look over the coding based on the
information I have provide. I would appreciate it very much. When I
select
yes or no I received a Runtime error 2427 " You entered an expression
that
has no value" or You tried to assign a Null value to a variable that is
not
a variant data type.

For Routing Exceptions Handling
If I select yes it enters the current date/time in a field called
ExceptionHandling,
If I select no exceptions it enters a grayed out field in a field called
ExceptionResolved

For Routing Exceptions Resolved
If I select Resolved it enters the current date/time in a field called
ExceptionResolved
If I select NotResolved it enters text which says 'Exception not
Resolved'

NEXT TO ROUTING EXCEPTIONS HANDLING
Option Button - YESEXCEPTIONBUTTON
Data - Option Value = 1
Event - On Got Focus button is as follows:

Private Sub YESEXCEPTIONBUTTON_GotFocus()
If Me.YESEXCEPTIONBUTTON = True Then
Me.[ExceptionsHandling] = Now()
Else
Me.[ExceptionsHandling] = Now()
Me.[Exceptions_Resolved] = ""
Me.[Exceptions_Resolved].Enabled = True

End If

End Sub


Option Button - NOEXCEPTIONBUTTON
Data - Option Value = 2
Event - On Got Focus
Event Procedure
Private Sub NOEXCEPTIONBUTTON_GotFocus()
If Me.NOEXCEPTIONBUTTON = True Then

Me.[Exceptions_Resolved].BackColor = 12632256
Else
Me.[Exceptions_Resolved].BackColor = 16777215

End If

End Sub

Other (Name) = YESEXCEPTIONBUTTON
******************************
NEXT TO THE EXCEPTION RESOLVED FIELD

Option Button - YESRESOLVEDBUTTON
Data - Option Value = 1
Event - On Got Focus
Event Procedure
If Me.Exceptionsyesbutton = -1 Then
Me.[Exceptions_Resolved] = Now()
End If

End Sub

OTHER (NAME) = YESRESOLVEDBUTTON
 

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