Make field invisible/inactive depending on combo box in Datasheet

S

Sarella

Hi,

I have a datasheet view subform which contains a combo box with 4 potential
choices.

If choices A or B of the combo box is selected, I want field X to be
available to add data to, but if choice C or D of the combo box is chosen, I
want field X to be unavailable to add data to - whether this be "greyed out"
or hidden I don't mind.

I have previously posted and been given the info below, which is great, but
only seems to work in form view, and I need my subform to be DATASHEET VIEW.

"Put code similar to this in the after update event of your combo box and also
in the On current event of the form

If Me.ComboBoxName = "Hire Weekly" or Me.ComboBoxName = "Hire Daily" Then
Me.TextBoxName.Visible = True
Else
Me.TextBoxName.Visible = False
End If"

Many Thanks :O)

Sarella
 
L

Linq Adams via AccessMonster.com

In Datasheet View you can't control Visibility, you'll have to use the
Enabled Property instead, with the code in the AfterUpdate and Form_Current
event.
 
M

Marshall Barton

Sarella said:
I have a datasheet view subform which contains a combo box with 4 potential
choices.

If choices A or B of the combo box is selected, I want field X to be
available to add data to, but if choice C or D of the combo box is chosen, I
want field X to be unavailable to add data to - whether this be "greyed out"
or hidden I don't mind.

I have previously posted and been given the info below, which is great, but
only seems to work in form view, and I need my subform to be DATASHEET VIEW.

"Put code similar to this in the after update event of your combo box and also
in the On current event of the form

If Me.ComboBoxName = "Hire Weekly" or Me.ComboBoxName = "Hire Daily" Then
Me.TextBoxName.Visible = True
Else
Me.TextBoxName.Visible = False
End If"


Right, you can not use code to manipulate a control's
properties in a continuous or datasheet form. You can use
the enabled property in Conditional Formatting (Format
menu) to do that row by row.
 

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