Conditional textbox

A

an

Hi!

I have a form with a textbox wich is visible only when I choose determinate
option in combobox.
Ex:

If Me.Combo46 = 12 Then
Me.Text210.Visible = True
Else
Me.Text210.Visible = False
End If

When record change and return to last record, the Text210 is not visible but
has data in field.

How is possible to force textbox appear when has data in this field, please?
Thanks in advance.
an
 
G

George Nicholson

Your code needs to be in 2 places: Combo46_AfterUpdate and Form_Current
Combo46_AfterUpdate will react to changes made to the current value and
Form_Current will react to values encountered when scrolling thru existing
records.

It can also be shortened to:
Me.Combo46.Visible = (Me.Combo46 = 12)
 
A

an

Perfectly!

Thanks very much.
an

George Nicholson said:
Your code needs to be in 2 places: Combo46_AfterUpdate and Form_Current
Combo46_AfterUpdate will react to changes made to the current value and
Form_Current will react to values encountered when scrolling thru existing
records.

It can also be shortened to:
Me.Combo46.Visible = (Me.Combo46 = 12)
 
A

an

Oops!

A litle correction in '...shortened to':
Me.Text210.Visible = (Me.Combo46 = 12)

Thanks more one time, GN.
an
 
A

an

Sorry, but in adition in code I have too:

If Me.Combo46 = 12 Then
Me.Text210.Visible = True
Me.Text210.SetFocus 'to cursor jump to next field
Else
Me.Text210.Visible = False
Me.Combo48.SetFocus 'to cursor jump to next field
End If

With your solution
Me.Combo46.Visible = (Me.Combo46 = 12)

How is possible to jump the cursor to next field, please?

an
 

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