a macro for preventing the entering of data

G

Guest

I have created an Access form that has 30 questions and I want to learn how
to make it so that if you answer “yes†to let’s say the first question, that
some of the other 29 questions will change shade and you won’t be able to
enter any values in those questions. Maybe this is a macro but I am not sure
how to do it…. Can you help?


Thanks

Sincerely,
 
J

Jim Evans

In the Click Event of the first question object, you would set the locked
and backcolor properties of the textboxes you wanted to disable.

Jim Evans
 
G

Guest

That sound like what you would do if you wanted to change the color and the
ability to enter values of the 1st question not the other 29??

Hadd0032
 
J

JulieD

Hi

Jim's got it right

e.g.
Private Sub Text0_Exit(Cancel As Integer)
If UCase(Text0.Value) = "YES" Then
Text4.Locked = True
Text4.BackColor = RGB(255, 255, 0)
Else
Text4.Locked = False
Text4.BackColor = RGB(255, 255, 255)
End If
End Sub

where Text0 is the name of the first question's control and Text4 is the
name of another control that you want to alter.

Cheers
JulieD
 
D

Dave Bradshaw

this is what you want

Private Sub QuestionOne_Click()
me!QuestionTwo.Enabled = False
etc.
End Sub

This will "grey out" the questions that are not required.
 

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