Empty Text Feild Function.

  • Thread starter Malik via AccessMonster.com
  • Start date
M

Malik via AccessMonster.com

Hi.
I have a TextBox in my form. I want that If user move to another Field
without entering a data in this TextBox, the field should Putt a specific
value in text box automatically.

Thanks
 
J

Jeanette Cunningham

Hi Malik,

If you do this in the form's before update event, it doesn't matter what
order the user chooses to fill in the controls.

You can code like this-->

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Len(Me.NameOfTextBox) >0 Then
'do nothing
Else
Me.NameOfTextBox = "TheValue"
End If
End Sub

Note: Replace NameOfTextBox and TheValue with your own values.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
L

Linq Adams via AccessMonster.com

Jeanette's advice is right on target! The problem with your approach, tying
your code to "exiting" the textbox without entering any data in it, is that
the user might not ever "enter" the textbox in the first place!
 

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