Mystery cursor

R

Russ

In my form I check for a certain value in a certain control in the
Before update part of the form. When the value is not in that range,
the code displays a message box and then moves the focus to the
offending control by MoveToControl.

Now the mystery part: I've run this form with the propertiies box
open, and although at that point the title of the properties box
indicates it is in the proper control text box, no cursor is visible.
In addition, if I try to type in the proper value, I get nothing... no
response. If I press the Tab key, the form advances to the sub-form
instead of the next control text box in the tab order. I would like
to see the cursor and be able to modify the in-error entry, but
somehow it does not work as anticipated. Anyone know why?
 
S

Scott Whetsell, A.S. - WVSP

I've never used the MoveToControl function, but frequently use SetFocus. You
may want to try it to see if that will do what you want.

Syntax is simply: Me.ControlName.SetFocus
 
R

Russ

My mistake. I meant GoToControl. Sorry.


I've never used the MoveToControl function, but frequently use SetFocus. You
may want to try it to see if that will do what you want.

Syntax is simply: Me.ControlName.SetFocus
 
S

Scott Whetsell, A.S. - WVSP

Again, I haven't used that method. The SetFocus seems to be the preferred
method. Instead of using DoCmd.GoToControl "ControlName", use
Me.ControlName.SetFocus.

If that doesn't work let me know and we'll go from there.
 
R

Russ

Ok Scott, you've got me by the short hairs now! I've been using the
macro Action GoToControl and not VB code. I tried writing some of my
own but it's a bit of a learning expeience.

What I want to do is check the value of a control called E58No, to see
if the number entered is in the range of 6294350 to 6296000. If not,
then advise the user to correct it and then move the cursor to that
field.
 
S

Scott Whetsell, A.S. - WVSP

Fair enough. I was not aware that you were using a macro to accomplish this,
my assumption was that you were using VB.

I'm not proficient using macros, so I'll show you how to accomplish what
you're trying to do using VB. I understand it's a learning experience, and I
welcome anyone with proficiency in using the macros to jump in and offer
thier solution too.

For the AfterUpdate event of your combo box select Event Procedure. Insert
the code below:


If Me.cboComboBoxName = "GROUP 1" Then
Select Case Me.E58No
Case 6294350 To 6296000
' Entry is fine, no action needed
Case Else
MsgBox "Message Box Text Here", vbOKOnly, "Title Bar Text"
Me.E58No.SetFocus
End Select
End If


That code checks the value of your combo box, and if GROUP 1 is selected, it
checks the value of your textbox. If the Value of the text box is between
your criteria, it does nothing, otherwise it displays a message box and
returns focus to the text box.
 

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