• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

default location of mouse pointer

in the attached, as soon as the tab is clicked, the pointer is at what the red circle is.. how can i bring it instead to where the blue circle is.. either on the last record or the new empty space...
0
25112
Asked:
25112
  • 13
  • 12
1 Solution
 
25112Author Commented:
here is the picture..
a.bmp
0
 
25112Author Commented:
>>either on the last record or the new empty space...
i mean the line where the 'play' button is or where the '*' is..
0
 
mbizupCommented:
On the ClickEvent of the relevant page in your tabcontrol:

Me.MySubformName.SetFocus
if me.MySubformName.Form.recordsetclone.recordcount > 0 then
    docmd.RunCommand acCmdRecordsGoToLast
End if
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
Jeffrey CoachmanCommented:
Just some notes, ...as your forms complete design and purpose is not known.

1. Remember that you should always have a Parent record in the Main form, before you add new child records into the subform.
2. If the subform will *always* be used for adding new records, you can set the Data Entry property of the subform to: Yes
0
 
mbizupCommented:
< either on the last record or the new empty space... >

Alternatively, on the click event of your tab page, do this:

Me.MysubformName.setfocus  '<-- put the focus on the subform
DoCmd.GoToRecord , , acNewRec   '<-- Move to a new record

Open in new window

0
 
25112Author Commented:
i did
Private Sub Pest_Page_Click()
Me.Herbicide.SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub

the cursor stays at rootworm level

i see another place in the code (below)..is that what stopping the above from effect?..
Private Sub FieldTabCtrl_Change()
  'Causes the default control's text to be "NOT selected".
  Select Case Me.FieldTabCtrl.Value
    Case 3      'Pest & Weed
      Me.RootWorm_Level.SelStart = 0
      Me.RootWorm_Level.SelLength = 0
  End Select
End Sub

Open in new window

0
 
mbizupCommented:
Hi,

That may affect it, but I also gave you the wrong Event for the code.  The Page Click event fires when you click the middle of the page, but not when you click the tab.

Move the code to your tab control's change event and implement it like this:


Private Sub FieldTabCtrl_Change()
  'Causes the default control's text to be "NOT selected".
  Select Case Me.FieldTabCtrl.Value
    Case 3      'Pest & Weed
      Me.RootWorm_Level.SelStart = 0
      Me.RootWorm_Level.SelLength = 0
  End Select

    If Me.FieldTabCtrl.Pages(Me.FieldTabCtrl).Name = "Pest_Page" Then
        Me.Herbicide.SetFocus
        DoCmd.GoToRecord , , acNewRec
    End If

End Sub

0
 
25112Author Commented:
mbizup, thanks but that is taking to a new record in the form..

for example, the form has 10 record.. each record has the tabs.. but the code is taking it to the 11th record, and then points at with "Me.Herbicide.SetFocus"

we just need the code to work when the user is in a record of the form, and then click on the tab, and then go to Me.Herbicide.SetFocus only for that form record, but the latest record line for Herbicide..

could you suggest?
0
 
mbizupCommented:
Ok - I thought you wanted a new record.

To go to the last record, change acNewRec to acLast in this line

>>  DoCmd.GoToRecord , , acNewRec

as follows:

 DoCmd.GoToRecord , , acLast
0
 
25112Author Commented:
mbizup, ..

but now the control goes to record # 10 and stays on the Herbicides first line.. regardless which 'pest&weed' tab you click for any of the 10 records.
0
 
25112Author Commented:
also with the last code, we get this:


err.bmp
0
 
25112Author Commented:
mbizup, could you kindly comment on the above pl
0
 
mbizupCommented:
Wow!

I was running a marathon the day you posted those comments and must have completely missed the email notifs.

Are you able to upload a sample (with any sensitive data masked or removed)?
0
 
25112Author Commented:
hope you had a winning run!

do you mean zip the mdb? or just the table data?
0
 
mbizupCommented:
Not sure if you received my reply to your email...

For a sample, compact/repair and zip the .mdb file -- ideally extract just the relevant parts into a new database.  Include just enough data to make things functional, making sure there is no personal or otherwise sensitive data in the sample.

The idea is to just post what is needed to recreate the issue you are seeing.
0
 
25112Author Commented:
mbizup, thanks for your patience.. i just got to this system where i got the app..

i am having some issues making a separate file.. kindly bear with me..

meanwhile, I am giving the screen shot for the tab we are interested in..

the default tab is "crops&lime" .. that's fine.. when we click "Pest & weed", it should go to the new line within 'Herbicide Description"' .. so in this screen shot, if we were in record 9 of 10, then the tab should automatically go below "Ammonium Sulphate".. but right now, with our code, it is creating record #11.

thanks again mbizup!
pw.bmp
0
 
mbizupCommented:
Are you able to post your actual .mdb or .accdb file?

That would make it easier to pinpoint what is going on.
0
 
mbizupCommented:
<<i am having some issues making a separate file>>

Sorry -- I just noticed this.

If it is possible, it will really help.  Otherwise I'll see what I can do without it.
0
 
mbizupCommented:
Okay - I think I undeerstand what is going on.

I thought you wanted to create a new record in a Subform.

What you are actually trying to do is create a new record in a sub-sub form.

I'm not sure of the names of your subform controls, but I think this should do the trick if you substitute the correct names:

    If Me.FieldTabCtrl.Pages(Me.FieldTabCtrl).Name = "Pest_Page" Then
        Me.MySubform.Form.SetFocus
        Me.MySubform.Form.MySubSubForm.SetFocus
        DoCmd.GoToRecord , , acNewRec
    End If

Open in new window

0
 
25112Author Commented:
thanks mbizup.your help with the statement alone 'Me.Herbicide.SetFocus' has helped the control to come to herbicide description part. but when i try the above to take to the new record within 'Harbiide Decription', then the control goes haywire.

can you help me with the below:

Herbicide Description (Application Rate) is the sub-sub-form, right?
FieldTabCtrl is what has the 5 tabs, of which the 4th is the 'Pest & Weed'
Is the Field Entry Data (10 records) the subform? o is FieldTabCtrl  considered a subform?
which will be the form?
0
 
mbizupCommented:
Hang on a bit - Your last post is confusing me because I can't see what you are referring to.

Lets try this a different way.


Fill in the blanks for me, and I'll try to answer your questions while I'm asking mine:

1.  The name of the main form is: _______________ ?

2.  The name of the subform control* that is showing 9 of 10 records is ________________ ?  (This is what I mean by the 'subform')

3.  The name of the subform control* that shows Herbicide Description is __________ ? (this is what I mean by the 'sub-sub form')

4.  The "control goes haywire" means that it ___________________ ?

** By 'Subform control' I mean the name of the frame in your form's design that contains the subform (this name might be different from the subform name as it shows in the databasae window.
If you can fill me in on those details, I think we can move a long way forward.

____

<< is FieldTabCtrl  considered a subform? >>

No - a tab control is not a subform.  Look at it like an organizer.  It simply expands the real estate on your form.  As far as syntax in referring to subforms on that tab control, the tab control can simply be ignored.  Syntactically, the subforms appear directly on their parent forms and can be referenced without any notation for the tab control.


0
 
25112Author Commented:
mbizup,

I greatly appreciate your help.

The client has not responded to me for me to come and check again. Could you give me one more week? If I am not able to check the software and respond to your questions?

you already helped me position the cursor on the child form, only i could not get to the new line within the child form, because i possibly did not name one of the form right- and if i answer your questions, I should be able to confirm/clarify.

thanks again
0
 
mbizupCommented:
Hey - You're back!  :-)

Take your time, but do post updates periodically to show that you are actively interested in it.

EE has automatic systems aimed at clearing out inactive questions.  Those systems are based on the date of the last posted comment.

0
 
25112Author Commented:
you're kind..

yes, i will keep you posted.
0
 
25112Author Commented:
mbizup, i could not get the client to get the machine available..

your help has helped satisfactory results..

Could I post an update when i get the laptop again?
0
 
mbizupCommented:
Yes - I'm still 'listening'.

EE no longer has the Ask a Related Question link, so if it is something that would be best off in a new thread, post the link to your follow up question here.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 13
  • 12
Tackle projects and never again get stuck behind a technical roadblock.
Join Now