Re Post about Cursor Position and Leaving field

G

Guest

I posted about a week ago and had some usefull feedback from J Goddard, but
ultimately it didn't resolve my problem, so here it is again;

My problem is the cursor remains in the field Text34, at the start of the
entered text, after the following code runs, I want it to leave and go to the
next field, or at worst go to the end of the text in Text34;

Private Sub Text34_AfterUpdate()
Dim stractiv As String

If strPtFilt = "" Then strPtFilt = "PtTbl.PtNum LIKE '*'"

If Not IsNull(Me![Text34]) Then
strDesc = Me![Text34]
Else: strDesc = "*"
End If

If Not IsNull(Me![Text39]) Then
Me.Filter = strPtFilt & " AND " & "PtTbl.PtDesc LIKE '*' & '" &
strDesc & "' & '*' AND PtTbl.PtDesc LIKE '*' & '" & strDesc2 & "' & '*'"
Else: Me.Filter = strPtFilt & " AND " & "PtTbl.PtDesc LIKE '*' & '" &
strDesc & "' & '*'"
End If

Me.FilterOn = True

End Sub

I have tried Me![Text34].SelStart = Len(Me![Text34]) and other options to
acheive the desired result, all to no avail.

Any other ideas?

TonyT..
 
R

ruralguy via AccessMonster.com

Why not just end the code with Me.NextControlName.SetFocus ? Using your
NextControlName of course.
I posted about a week ago and had some usefull feedback from J Goddard, but
ultimately it didn't resolve my problem, so here it is again;

My problem is the cursor remains in the field Text34, at the start of the
entered text, after the following code runs, I want it to leave and go to the
next field, or at worst go to the end of the text in Text34;

Private Sub Text34_AfterUpdate()
Dim stractiv As String

If strPtFilt = "" Then strPtFilt = "PtTbl.PtNum LIKE '*'"

If Not IsNull(Me![Text34]) Then
strDesc = Me![Text34]
Else: strDesc = "*"
End If

If Not IsNull(Me![Text39]) Then
Me.Filter = strPtFilt & " AND " & "PtTbl.PtDesc LIKE '*' & '" &
strDesc & "' & '*' AND PtTbl.PtDesc LIKE '*' & '" & strDesc2 & "' & '*'"
Else: Me.Filter = strPtFilt & " AND " & "PtTbl.PtDesc LIKE '*' & '" &
strDesc & "' & '*'"
End If

Me.FilterOn = True

End Sub

I have tried Me![Text34].SelStart = Len(Me![Text34]) and other options to
acheive the desired result, all to no avail.

Any other ideas?

TonyT..
 
G

Guest

Hi RG,

I hate *forcing* focus moves when the user could have pressed Alt+Tab or
mouse clicked one of the other fields on the form, but it might have to come
down to that if their is no other way out there.

TonyT..

ruralguy via AccessMonster.com said:
Why not just end the code with Me.NextControlName.SetFocus ? Using your
NextControlName of course.
I posted about a week ago and had some usefull feedback from J Goddard, but
ultimately it didn't resolve my problem, so here it is again;

My problem is the cursor remains in the field Text34, at the start of the
entered text, after the following code runs, I want it to leave and go to the
next field, or at worst go to the end of the text in Text34;

Private Sub Text34_AfterUpdate()
Dim stractiv As String

If strPtFilt = "" Then strPtFilt = "PtTbl.PtNum LIKE '*'"

If Not IsNull(Me![Text34]) Then
strDesc = Me![Text34]
Else: strDesc = "*"
End If

If Not IsNull(Me![Text39]) Then
Me.Filter = strPtFilt & " AND " & "PtTbl.PtDesc LIKE '*' & '" &
strDesc & "' & '*' AND PtTbl.PtDesc LIKE '*' & '" & strDesc2 & "' & '*'"
Else: Me.Filter = strPtFilt & " AND " & "PtTbl.PtDesc LIKE '*' & '" &
strDesc & "' & '*'"
End If

Me.FilterOn = True

End Sub

I have tried Me![Text34].SelStart = Len(Me![Text34]) and other options to
acheive the desired result, all to no avail.

Any other ideas?

TonyT..

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ruralguy via AccessMonster.com

I completely understand. Is this control the first control in the tab order?
I believe turning on the filter will cause a requery on the form.
Hi RG,

I hate *forcing* focus moves when the user could have pressed Alt+Tab or
mouse clicked one of the other fields on the form, but it might have to come
down to that if their is no other way out there.

TonyT..
Why not just end the code with Me.NextControlName.SetFocus ? Using your
NextControlName of course.
[quoted text clipped - 33 lines]
 
G

Guest

Thanks a million RG,

Your post got me to thinking, and now I have a string that takes the full
filter (not just the search words) and a sgl variable which tells me when the
filter string has changed, and I simply look for the variable in the on_enter
event of the other 4 controls and apply the filter (if required) on_enter of
the control that then has the focus.
Bit long winded, and the only downside I can see is the possibility of re
applying the same filter twice on some occasions, but not the end of the
world!

TonyT..
ruralguy via AccessMonster.com said:
I completely understand. Is this control the first control in the tab order?
I believe turning on the filter will cause a requery on the form.
Hi RG,

I hate *forcing* focus moves when the user could have pressed Alt+Tab or
mouse clicked one of the other fields on the form, but it might have to come
down to that if their is no other way out there.

TonyT..
Why not just end the code with Me.NextControlName.SetFocus ? Using your
NextControlName of course.
[quoted text clipped - 33 lines]
 
R

ruralguy via AccessMonster.com

Sounds like a plan Tony. Thanks for posting back.
Thanks a million RG,

Your post got me to thinking, and now I have a string that takes the full
filter (not just the search words) and a sgl variable which tells me when the
filter string has changed, and I simply look for the variable in the on_enter
event of the other 4 controls and apply the filter (if required) on_enter of
the control that then has the focus.
Bit long winded, and the only downside I can see is the possibility of re
applying the same filter twice on some occasions, but not the end of the
world!

TonyT..
I completely understand. Is this control the first control in the tab order?
I believe turning on the filter will cause a requery on the form.
[quoted text clipped - 12 lines]
 

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