Field focus and making MDE files

jrjr

A work in progress
Local time
Yesterday, 23:54
Joined
Jul 23, 2004
Messages
291
When I insert this code:

Private Sub Phone_Click()
Me.Phone.SelStart = 0
End Sub

Access will no longer make an MDE file. I was trying to make it so when the Phone field was clicked in the focus would be at the beginning of the field.

If I remove these lines, an MDE is possible again. I have tried it at the beginning and at the end. Any thoughts?
 
Your code does not compile (code errors) if you are not able to convert to MDE. This will do what you want...

Code:
    Me.Phone.SetFocus
    Me!Phone.SelStart = Me!Phone.SelStart
 
Private Sub Phone_Click()
Me.Phone.SetFocus
Me!Phone.SelStart = Me!Phone.SelStart
End Sub

This will not compile either, and does not set focus at the beginning of the field.
Also tried:

Private Sub Phone_Click()
Me.Phone.SetFocus
Me!Phone.SelStart = 0
End Sub

That sets focus at beginning but wont compile
 
Curious, as I tried this and it works/compiles/allows MDE creation (A2k):
Code:
Private Sub operator_Click()
  Me.operator.SelStart = 0
End Sub
 
I am using 2000 as well...
It works nicely to bring focus to the beginning of the field.
It won't compile for me though, this is the first trouble I have had ever compiling anything.
 
Ok, I figured it out with debug. For some reason this code brought another error into focus that was being missed before. That is strange because if I deleted these few lines it would compile fine. Well, I am set now but will have to work on what I removed and get it right. Thanks for the help guys!
 
Can you post a small sample db, since it only seems to be a problem in your specific situation? There must be something else going on.

Edit: never mind, we posted at the same time. Glad you sorted it out.
 
ghudson said:
Your code does not compile (code errors) if you are not able to convert to MDE. This will do what you want...

Code:
    Me.Phone.SetFocus
    Me!Phone.SelStart = Me!Phone.SelStart

I have trouble to make a MDE file. I know that I have a lot of code that are not used in the code. How can I compile the program and get rid of them.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom