open form without seting focus(?)

M

Mark Kubicki

questions of the day (at least for me)

I have a small pop-up form whose only purpose is to display information. It
has a few text boxes, all of which are locked...

1st issue:
when the form opens, the 1st text box is selected (like when you would
double click text to edit an entire word / field); I don't really want
anything selected... the box can have focus, but the text shouldn't be
"selected". How to I get this?

2nd issue:
I want to check the value of one of the fields when the box opens; if it is
null, then I'll make a label visible (providing the user some additional
direction). What event is this suppose to go behind; at this point, I feel
as though I've tried them all -except the right one!

thanks in advance,
mark
 
D

Douglas J. Steele

To not have the text selected, associate the following code with the text
box's OnGotFocus:

Private Sub MyTextBox_GotFocus()

Me.MyTextBox.SelStart = 0

End Sub

Associate your code to check for the value in the form's On Current event:

Private Sub Form_Current()

Me.SomeLabel.Visible = IsNull(Me.SomeTextBox)

End Sub
 
M

Mark Kubicki

that worked fine (thanks) both of them
but 1 more point with the 1st issue (Me.MyTextBox.SelStart = 0)...

when i add this code, the text box, whichi s a phone number, displays the
entry but without the formatting (2126757760, not (212) 675-7760 x123)
....if you couold help me on this also...

-mark
-------------------------------------------------
 
D

Douglas J. Steele

Hmm. Sorry, but I don't have that problem when I use the code so I have no
idea what to suggest.
 

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