Questions

  • Thread starter Thread starter RJS76 via AccessMonster.com
  • Start date Start date
R

RJS76 via AccessMonster.com

Hi,

I have created a form based on a query in which employees need to answer some
questions with the help of pull down menus (Yes/No). One of the questions
they need to answer is:

Name in register?

If this question is answered with Yes then they need to answer the next
question:

Signature correct?

If the question "Name in Register" is answered with No then there is no need
to answer the question "Signature correct". What I would like to do is that
if the first question is answered with Yes the second question becomes active.
If it is answered with No then the second question stays greyed out so that
it cannot be answered.

Is there any way to do this?

Thanks for your help.
 
RJS76 said:
Hi,

I have created a form based on a query in which employees need to answer some
questions with the help of pull down menus (Yes/No). One of the questions
they need to answer is:

Name in register?

If this question is answered with Yes then they need to answer the next
question:

Signature correct?

If the question "Name in Register" is answered with No then there is no need
to answer the question "Signature correct". What I would like to do is that
if the first question is answered with Yes the second question becomes active.
If it is answered with No then the second question stays greyed out so that
it cannot be answered.

Is there any way to do this?

Thanks for your help.

Sure. You can use the AfterUpdate event of the Name In Register combo
box to enable/disable the signature combobox.

Psuedo-Code (your names are different)

Private Sub cboNameInRegister_AfterUpdate()
If cboNameInRegister = "Yes" Then
cboSignatureCorrect.Enabled = True
Else
cboSignatureCorrect.Enabled = True
End If
End Sub
 
Hi Duncan,

Thanks for your reply. I've tried your suggestion but I cannot seem to get it
to work. When I insert your code and replace the names with the one I use I
get an error message 424.

This is the code:

Private Sub Handtekening_register_AfterUpdate()
If cboHandtekening_Register = "Ja" Then
cboHandtekening_akkoord.Enabled = True
Else
cboHandtekening_akkoord.Enabled = True (<-- this is being highlighted
when running it)
End If
End Sub

Is there something I'm doing wrong?

Thanks.

RJS

Duncan said:
[quoted text clipped - 18 lines]
Thanks for your help.

Sure. You can use the AfterUpdate event of the Name In Register combo
box to enable/disable the signature combobox.

Psuedo-Code (your names are different)

Private Sub cboNameInRegister_AfterUpdate()
If cboNameInRegister = "Yes" Then
cboSignatureCorrect.Enabled = True
Else
cboSignatureCorrect.Enabled = True
End If
End Sub
 
I am very new to access so please take my comments lightly ..but looking at
the code that has been typed. to me you have 2 lines that both include "true"
cboHandtekening_akkoord.Enabled = True
Else
cboHandtekening_akkoord.Enabled = True

just wondering of the second line should read "false" and that might stop the
error message?

so...
Private Sub Handtekening_register_AfterUpdate()
If cboHandtekening_Register = "Ja" Then
cboHandtekening_akkoord.Enabled = True
Else
cboHandtekening_akkoord.Enabled = False
End If
End Sub

just an idea
Hi Duncan,

Thanks for your reply. I've tried your suggestion but I cannot seem to get it
to work. When I insert your code and replace the names with the one I use I
get an error message 424.

This is the code:

Private Sub Handtekening_register_AfterUpdate()
If cboHandtekening_Register = "Ja" Then
cboHandtekening_akkoord.Enabled = True
Else
cboHandtekening_akkoord.Enabled = True (<-- this is being highlighted
when running it)
End If
End Sub

Is there something I'm doing wrong?

Thanks.

RJS
[quoted text clipped - 14 lines]
End If
End Sub
 
Hello roppa,

Thanks for your suggestion. I also noticed that and also tried replacing it
with False, but that didn't help much either. I got the same error. I also
tried:

Else
cboHandtekening_akkoord.Disabled = True

But that also didn't work.

Any other suggestions?
I am very new to access so please take my comments lightly ..but looking at
the code that has been typed. to me you have 2 lines that both include "true"
cboHandtekening_akkoord.Enabled = True
Else
cboHandtekening_akkoord.Enabled = True

just wondering of the second line should read "false" and that might stop the
error message?

so...
Private Sub Handtekening_register_AfterUpdate()
If cboHandtekening_Register = "Ja" Then
[quoted text clipped - 3 lines]
End If
End Sub

just an idea
Hi Duncan,
[quoted text clipped - 24 lines]
 
RJS76 said:
Hello roppa,

Thanks for your suggestion. I also noticed that and also tried replacing it
with False, but that didn't help much either. I got the same error. I also
tried:

Else
cboHandtekening_akkoord.Disabled = True

But that also didn't work.

Nope, that's not it.

It should read false. I was doing the pseudo code and copied/pasted that
line and didn't change it to false.

The code I gave is really simple. There should be no reason that an
error 424 is being generated. Error 424: object required seems to be
generated for a variety of different things including DAO references,
Internet Explorer 6 and bad syntax for the object call itself!

Even though the error handler is stopping on the second line, I'm more
inclined the think the error is elsewhere.

Here is your code:
Private Sub Handtekening_register_AfterUpdate()
If cboHandtekening_Register = "Ja" Then
cboHandtekening_akkoord.Enabled = True
Else
cboHandtekening_akkoord.Enabled = False
End If
End Sub

Without doing the translation to English, the following needs to be true
"Handtekening_register" needs to be the name of a control which has an
after update event, such as a textbox or combobox.
"cboHandtekening_akkoord" needs to be the name of the control you are
trying to enable/disable.

I thought from your earlier description that you had a series of
comboboxes, and that the value of the first (yes/no) would determine
whether the second could be picked or not.

However, in the above code you are using no prefix on
"Handtekening_register" and using the "cbo" prefix on the second control.

The leads me to think that maybe the wrong controls are being referenced
in the code.

if fact, I think the error is being generated by the IF statement
itself, not the else statement.

Your function is called: Handtekening_register
Your if checks the value of: cboHandtekening_Register

They should match!

The final incarnation should look like this (replace the portion inside
the brackets, and the brackets themselves. For example
[ControlName].Enabled should be txtControlName.Enabled)

Private Sub [NameOfControlWhichContainsTheYesOrNoValue]_AfterUpdate()
If [NameOfControlWhichContainsTheYesOrNoValue] = "Ja" Then
[NameOfControlToEnable].Enabled = True
Else
[NameOfControlToEnable].Enabled = False
End If
End Sub
 
Thanks Duncan. This works!

Duncan said:
Hello roppa,
[quoted text clipped - 6 lines]
But that also didn't work.

Nope, that's not it.

It should read false. I was doing the pseudo code and copied/pasted that
line and didn't change it to false.

The code I gave is really simple. There should be no reason that an
error 424 is being generated. Error 424: object required seems to be
generated for a variety of different things including DAO references,
Internet Explorer 6 and bad syntax for the object call itself!

Even though the error handler is stopping on the second line, I'm more
inclined the think the error is elsewhere.

Here is your code:
Private Sub Handtekening_register_AfterUpdate()
If cboHandtekening_Register = "Ja" Then
cboHandtekening_akkoord.Enabled = True
Else
cboHandtekening_akkoord.Enabled = False
End If
End Sub

Without doing the translation to English, the following needs to be true
"Handtekening_register" needs to be the name of a control which has an
after update event, such as a textbox or combobox.
"cboHandtekening_akkoord" needs to be the name of the control you are
trying to enable/disable.

I thought from your earlier description that you had a series of
comboboxes, and that the value of the first (yes/no) would determine
whether the second could be picked or not.

However, in the above code you are using no prefix on
"Handtekening_register" and using the "cbo" prefix on the second control.

The leads me to think that maybe the wrong controls are being referenced
in the code.

if fact, I think the error is being generated by the IF statement
itself, not the else statement.

Your function is called: Handtekening_register
Your if checks the value of: cboHandtekening_Register

They should match!

The final incarnation should look like this (replace the portion inside
the brackets, and the brackets themselves. For example
[ControlName].Enabled should be txtControlName.Enabled)

Private Sub [NameOfControlWhichContainsTheYesOrNoValue]_AfterUpdate()
If [NameOfControlWhichContainsTheYesOrNoValue] = "Ja" Then
[NameOfControlToEnable].Enabled = True
Else
[NameOfControlToEnable].Enabled = False
End If
End Sub
 
Back
Top