MouseWheel in Continuous Forms

D

DebbieG

I am using the following code to prevent use of the MouseWheel when editing
records:

There is a textbox on my form called UnboundTextBox.

Private mWheel As Boolean
Private validationTrigger As wsTrigger

Private Enum wsTrigger
MyWheel = 1
NotTheWheel = 2
End Enum

Private Function WheelSpin() As Integer
WheelSpin = mWheel
Select Case validationTrigger
Case NotTheWheel
mWheel = False
End Select
End Function

Private Sub Form_Error(DataErr As Integer, Response As Integer)
If Screen.ActiveControl.Name = "UnboundTextBox" Then
Response = acDataErrContinue
End If
End Sub

Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
On Error GoTo GotError
If Me.Dirty Then
mWheel = True
validationTrigger = MyWheel
Me.UnboundTextBox.SetFocus
Me.UnboundTextBox.Text = " "
End If

ExitSub:
validationTrigger = NotTheWheel
Exit Sub

GotError:
If Err.Number = 2107 Then
CompleteMsg 'a standard message that they must complete the edit
Resume ExitSub
End If
MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf &
"Form_MouseWheel"
Resume ExitSub
End Sub

This works great on single forms. This makes sense because basically the
MouseWheel is similar to PageUp and PageDown.

However, when editing on continuous forms, it ALLOWS the scroll and if the
user clicks on another record, they get the "CompleteMsg" from
Form_BeforeUpdate which is great ... but how can I make it scroll back to
the edited record so they don't have to scroll to find it. I don't want to
turn off the MouseWheel completely because that is handy in the continuous
forms.

Is there a way to bookmark the edited record or a way to not allow the
MouseWheel if editing on a continuous form?

Thanks,
Debbie
 
P

Peter Yang [MSFT]

Hello Debbie,

Form has a bookmark property that might help. Also, you can use
RecordsetClone of the form to get more flexibility. I have included the
following article for your reference:

128883 ACC2: How to Get "X of Y" from Record Navigation Buttons
http://support.microsoft.com/?id=128883

294202 How to enumerate selected form records in Access 2002
http://support.microsoft.com/?id=294202

Hope this helps.

Peter Yang
MCSE2000, MCSA, MCDBA
Microsoft Partner Online Support

Get Secure! - www.microsoft.com/security

=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| From: "DebbieG" <[email protected]>
| Subject: MouseWheel in Continuous Forms
| Date: Tue, 14 Dec 2004 16:08:43 -0600
| Lines: 67
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.access.formscoding
| NNTP-Posting-Host: t2p744.stmo2.socket.net 64.85.218.237
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
..phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255436
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| I am using the following code to prevent use of the MouseWheel when
editing
| records:
|
| There is a textbox on my form called UnboundTextBox.
|
| Private mWheel As Boolean
| Private validationTrigger As wsTrigger
|
| Private Enum wsTrigger
| MyWheel = 1
| NotTheWheel = 2
| End Enum
|
| Private Function WheelSpin() As Integer
| WheelSpin = mWheel
| Select Case validationTrigger
| Case NotTheWheel
| mWheel = False
| End Select
| End Function
|
| Private Sub Form_Error(DataErr As Integer, Response As Integer)
| If Screen.ActiveControl.Name = "UnboundTextBox" Then
| Response = acDataErrContinue
| End If
| End Sub
|
| Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
| On Error GoTo GotError
| If Me.Dirty Then
| mWheel = True
| validationTrigger = MyWheel
| Me.UnboundTextBox.SetFocus
| Me.UnboundTextBox.Text = " "
| End If
|
| ExitSub:
| validationTrigger = NotTheWheel
| Exit Sub
|
| GotError:
| If Err.Number = 2107 Then
| CompleteMsg 'a standard message that they must complete the
edit
| Resume ExitSub
| End If
| MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf &
| "Form_MouseWheel"
| Resume ExitSub
| End Sub
|
| This works great on single forms. This makes sense because basically the
| MouseWheel is similar to PageUp and PageDown.
|
| However, when editing on continuous forms, it ALLOWS the scroll and if
the
| user clicks on another record, they get the "CompleteMsg" from
| Form_BeforeUpdate which is great ... but how can I make it scroll back to
| the edited record so they don't have to scroll to find it. I don't want
to
| turn off the MouseWheel completely because that is handy in the
continuous
| forms.
|
| Is there a way to bookmark the edited record or a way to not allow the
| MouseWheel if editing on a continuous form?
|
| Thanks,
| Debbie
|
|
|
 
D

DebbieG

I'm partially successful. I added the following code to Form_BeforeUpdate,
Form_KeyDown (for PageUp and PageDown), and on my cmdClose button:

If Me.Dirty Then
CompleteMsg - a standard message that user must complete the
edited record
Dim recordnum As Long
recordnum = Me.CurrentRecord
DoCmd.GoToRecord , , acGoTo, recordnum
Exit Sub
End If

If I use the MouseWheel and click on another record, or use the PageUp or
PageDown key it goes to the edited record. GREAT! However, if I click on
the cmdClose button the screen doesn't move to the edited record. I've
tried using Me.RecordsetClone.AbsolutePosition +1 and Me.RecordsetClone.Move
Me.SelTop and recordnum = me.SelTop and bookmark and still it doesn't move
to the edited record.

What in the world am I missing?

Debbie


| Hello Debbie,
|
| Form has a bookmark property that might help. Also, you can use
| RecordsetClone of the form to get more flexibility. I have included the
| following article for your reference:
|
| 128883 ACC2: How to Get "X of Y" from Record Navigation Buttons
| http://support.microsoft.com/?id=128883
|
| 294202 How to enumerate selected form records in Access 2002
| http://support.microsoft.com/?id=294202
|
| Hope this helps.
|
| Peter Yang
| MCSE2000, MCSA, MCDBA
| Microsoft Partner Online Support
|
| Get Secure! - www.microsoft.com/security
|
| =====================================================
| When responding to posts, please "Reply to Group" via
| your newsreader so that others may learn and benefit
| from your issue.
| =====================================================
| This posting is provided "AS IS" with no warranties, and confers no
rights.
|
|
| --------------------
|| From: "DebbieG" <[email protected]>
|| Subject: MouseWheel in Continuous Forms
|| Date: Tue, 14 Dec 2004 16:08:43 -0600
|| Lines: 67
|| X-Priority: 3
|| X-MSMail-Priority: Normal
|| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
|| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
|| Message-ID: <#[email protected]>
|| Newsgroups: microsoft.public.access.formscoding
|| NNTP-Posting-Host: t2p744.stmo2.socket.net 64.85.218.237
|| Path:
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
| phx.gbl!TK2MSFTNGP09.phx.gbl
|| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255436
|| X-Tomcat-NG: microsoft.public.access.formscoding
||
|| I am using the following code to prevent use of the MouseWheel when
| editing
|| records:
||
|| There is a textbox on my form called UnboundTextBox.
||
|| Private mWheel As Boolean
|| Private validationTrigger As wsTrigger
||
|| Private Enum wsTrigger
|| MyWheel = 1
|| NotTheWheel = 2
|| End Enum
||
|| Private Function WheelSpin() As Integer
|| WheelSpin = mWheel
|| Select Case validationTrigger
|| Case NotTheWheel
|| mWheel = False
|| End Select
|| End Function
||
|| Private Sub Form_Error(DataErr As Integer, Response As Integer)
|| If Screen.ActiveControl.Name = "UnboundTextBox" Then
|| Response = acDataErrContinue
|| End If
|| End Sub
||
|| Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
|| On Error GoTo GotError
|| If Me.Dirty Then
|| mWheel = True
|| validationTrigger = MyWheel
|| Me.UnboundTextBox.SetFocus
|| Me.UnboundTextBox.Text = " "
|| End If
||
|| ExitSub:
|| validationTrigger = NotTheWheel
|| Exit Sub
||
|| GotError:
|| If Err.Number = 2107 Then
|| CompleteMsg 'a standard message that they must complete the
| edit
|| Resume ExitSub
|| End If
|| MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf &
|| "Form_MouseWheel"
|| Resume ExitSub
|| End Sub
||
|| This works great on single forms. This makes sense because basically the
|| MouseWheel is similar to PageUp and PageDown.
||
|| However, when editing on continuous forms, it ALLOWS the scroll and if
| the
|| user clicks on another record, they get the "CompleteMsg" from
|| Form_BeforeUpdate which is great ... but how can I make it scroll back to
|| the edited record so they don't have to scroll to find it. I don't want
| to
|| turn off the MouseWheel completely because that is handy in the
| continuous
|| forms.
||
|| Is there a way to bookmark the edited record or a way to not allow the
|| MouseWheel if editing on a continuous form?
||
|| Thanks,
|| Debbie
||
||
||
|
 
P

Peter Yang [MSFT]

Hello Debbie,

This occurs because Me.CurrentRecord is updated when the command click
event occurs.

I suggest that you define a global variable PreRecordnum, and let it equal
to Me.CurrentRecord whenever it is changed in your own code
(orm_BeforeUpdate, Form_KeyDown for PageUp and PageDown). You can use the
following code to go back to previous record in cmdClose button.

DoCmd.GoToRecord , , acGoTo, PreRecordnum

Hope this information is helpful.

Peter Yang
MCSE2000, MCSA, MCDBA
Microsoft Partner Online Support

Get Secure! - www.microsoft.com/security

=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| From: "DebbieG" <[email protected]>
| References: <#[email protected]>
<[email protected]>
| Subject: Re: MouseWheel in Continuous Forms
| Date: Wed, 15 Dec 2004 03:38:42 -0600
| Lines: 150
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#UW#[email protected]>
| Newsgroups: microsoft.public.access.formscoding
| NNTP-Posting-Host: t1p203.stmo2.socket.net 64.85.214.205
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255475
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| I'm partially successful. I added the following code to
Form_BeforeUpdate,
| Form_KeyDown (for PageUp and PageDown), and on my cmdClose button:
|
| If Me.Dirty Then
| CompleteMsg - a standard message that user must complete the
| edited record
| Dim recordnum As Long
| recordnum = Me.CurrentRecord
| DoCmd.GoToRecord , , acGoTo, recordnum
| Exit Sub
| End If
|
| If I use the MouseWheel and click on another record, or use the PageUp or
| PageDown key it goes to the edited record. GREAT! However, if I click
on
| the cmdClose button the screen doesn't move to the edited record. I've
| tried using Me.RecordsetClone.AbsolutePosition +1 and
Me.RecordsetClone.Move
| Me.SelTop and recordnum = me.SelTop and bookmark and still it doesn't
move
| to the edited record.
|
| What in the world am I missing?
|
| Debbie
|
|
| | | Hello Debbie,
| |
| | Form has a bookmark property that might help. Also, you can use
| | RecordsetClone of the form to get more flexibility. I have included the
| | following article for your reference:
| |
| | 128883 ACC2: How to Get "X of Y" from Record Navigation Buttons
| | http://support.microsoft.com/?id=128883
| |
| | 294202 How to enumerate selected form records in Access 2002
| | http://support.microsoft.com/?id=294202
| |
| | Hope this helps.
| |
| | Peter Yang
| | MCSE2000, MCSA, MCDBA
| | Microsoft Partner Online Support
| |
| | Get Secure! - www.microsoft.com/security
| |
| | =====================================================
| | When responding to posts, please "Reply to Group" via
| | your newsreader so that others may learn and benefit
| | from your issue.
| | =====================================================
| | This posting is provided "AS IS" with no warranties, and confers no
| rights.
| |
| |
| | --------------------
| || From: "DebbieG" <[email protected]>
| || Subject: MouseWheel in Continuous Forms
| || Date: Tue, 14 Dec 2004 16:08:43 -0600
| || Lines: 67
| || X-Priority: 3
| || X-MSMail-Priority: Normal
| || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| || Message-ID: <#[email protected]>
| || Newsgroups: microsoft.public.access.formscoding
| || NNTP-Posting-Host: t2p744.stmo2.socket.net 64.85.218.237
| || Path:
| |
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
| | phx.gbl!TK2MSFTNGP09.phx.gbl
| || Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255436
| || X-Tomcat-NG: microsoft.public.access.formscoding
| ||
| || I am using the following code to prevent use of the MouseWheel when
| | editing
| || records:
| ||
| || There is a textbox on my form called UnboundTextBox.
| ||
| || Private mWheel As Boolean
| || Private validationTrigger As wsTrigger
| ||
| || Private Enum wsTrigger
| || MyWheel = 1
| || NotTheWheel = 2
| || End Enum
| ||
| || Private Function WheelSpin() As Integer
| || WheelSpin = mWheel
| || Select Case validationTrigger
| || Case NotTheWheel
| || mWheel = False
| || End Select
| || End Function
| ||
| || Private Sub Form_Error(DataErr As Integer, Response As Integer)
| || If Screen.ActiveControl.Name = "UnboundTextBox" Then
| || Response = acDataErrContinue
| || End If
| || End Sub
| ||
| || Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
| || On Error GoTo GotError
| || If Me.Dirty Then
| || mWheel = True
| || validationTrigger = MyWheel
| || Me.UnboundTextBox.SetFocus
| || Me.UnboundTextBox.Text = " "
| || End If
| ||
| || ExitSub:
| || validationTrigger = NotTheWheel
| || Exit Sub
| ||
| || GotError:
| || If Err.Number = 2107 Then
| || CompleteMsg 'a standard message that they must complete the
| | edit
| || Resume ExitSub
| || End If
| || MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf &
| || "Form_MouseWheel"
| || Resume ExitSub
| || End Sub
| ||
| || This works great on single forms. This makes sense because basically
the
| || MouseWheel is similar to PageUp and PageDown.
| ||
| || However, when editing on continuous forms, it ALLOWS the scroll and if
| | the
| || user clicks on another record, they get the "CompleteMsg" from
| || Form_BeforeUpdate which is great ... but how can I make it scroll back
to
| || the edited record so they don't have to scroll to find it. I don't
want
| | to
| || turn off the MouseWheel completely because that is handy in the
| | continuous
| || forms.
| ||
| || Is there a way to bookmark the edited record or a way to not allow the
| || MouseWheel if editing on a continuous form?
| ||
| || Thanks,
| || Debbie
| ||
| ||
| ||
| |
|
|
|
 
A

Allen Browne

Hi Debbie. Interesting thread.

You are wanting to prevent the user from moving to another record until the
current one is validated? As Peter pointed out, just use the BeforeUpdate
event of the form to do that. You do not need to use the MouseWheel event at
all.

If you cancel the Form_BeforeUpdate event, it stops the user from moving to
another record at all. That is true regardless of how the attempt to move
record was triggered: nav buttons, mouse wheel, Records menu, etc.

The reason your close button does not appear to work is a completely
unrelated, serious, data-loss bug that has been present in Access from the
beginning. If use use the Close action to close a form at a time when it is
dirty with a record that cannot be saved, it just silently discards your
changes. In my view, that's a horrendous bug in a piece of software that is
supposed to save by default, and it doesn't tell you that it the record was
not saved. I've tried several times over many years, but I can't get
Microsoft to fix this bug. More info in this article:
Losing data when you close a form
at:
http://members.iinet.net.au/~allenbrowne/bug-01.html

Once you know about the bug, it is easy enough to code around it. In any
code that issues the Close action, you must explicitly save first, e.g.:
Private Sub cmdClose_Click()
If Me.Dirty Then
Me.Dirty = False
End If
DoCmd.Close acForm, Me.Name
End Sub

Add error handling, as the attempt to set the form's Dirty property will
fail if the record can't be saved. Your error handler then picks it up
before it executes the Close.

Please post back if I have misunderstood your needs. I've not found the
form's MouseWheel event useful at all:
- You cannot cancel the event.
- It fails to respect the Page property of the form (and is therefore not
the same as PageUp/PageDown).
- The count is not very useful (other than determining direction, i.e.
positive/negative),.
- The behavior is not consistent (e.g. the current record does not change in
Datasheet view as it does when you use PageUp/PageDown).
 
D

DebbieG

When I click on cmdClose it knows what the current record is, it just
doesn't GoTo it.

I found if I GoTo a specific control and then GoTo the current record, it
works but it goes to a specific field.

This goes to the current record and to a specific control:

Private Sub cmdClose_Click()
If Me.Dirty Then
CompleteMsg
Dim recordnum As Long
recordnum = Me.CurrentRecord
DoCmd.GoToControl "DrugScreenCD_combo"
DoCmd.GoToRecord , "", acGoTo, recordnum
Exit Sub
End If
End Sub

This does nothing:

Private Sub cmdClose_Click()
If Me.Dirty Then
CompleteMsg
Dim recordnum As Long
recordnum = Me.CurrentRecord
' DoCmd.GoToControl "DrugScreenCD_combo"
DoCmd.GoToRecord , "", acGoTo, recordnum
Exit Sub
End If
End Sub

Is there a way to know which control was active before I clicked on cmdClose
and go to it during cmdCose_Click? If this requires a Global variable,
please be specific in how to code it and where to place the code.

Debbie


| Hello Debbie,
|
| This occurs because Me.CurrentRecord is updated when the command click
| event occurs.
|
| I suggest that you define a global variable PreRecordnum, and let it equal
| to Me.CurrentRecord whenever it is changed in your own code
| (orm_BeforeUpdate, Form_KeyDown for PageUp and PageDown). You can use the
| following code to go back to previous record in cmdClose button.
|
| DoCmd.GoToRecord , , acGoTo, PreRecordnum
|
| Hope this information is helpful.
|
| Peter Yang
| MCSE2000, MCSA, MCDBA
| Microsoft Partner Online Support
|
| Get Secure! - www.microsoft.com/security
|
| =====================================================
| When responding to posts, please "Reply to Group" via
| your newsreader so that others may learn and benefit
| from your issue.
| =====================================================
| This posting is provided "AS IS" with no warranties, and confers no
rights.
|
|
| --------------------
|| From: "DebbieG" <[email protected]>
|| References: <#[email protected]>
| <[email protected]>
|| Subject: Re: MouseWheel in Continuous Forms
|| Date: Wed, 15 Dec 2004 03:38:42 -0600
|| Lines: 150
|| X-Priority: 3
|| X-MSMail-Priority: Normal
|| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
|| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
|| Message-ID: <#UW#[email protected]>
|| Newsgroups: microsoft.public.access.formscoding
|| NNTP-Posting-Host: t1p203.stmo2.socket.net 64.85.214.205
|| Path:
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
| phx.gbl
|| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255475
|| X-Tomcat-NG: microsoft.public.access.formscoding
||
|| I'm partially successful. I added the following code to
| Form_BeforeUpdate,
|| Form_KeyDown (for PageUp and PageDown), and on my cmdClose button:
||
|| If Me.Dirty Then
|| CompleteMsg - a standard message that user must complete the
|| edited record
|| Dim recordnum As Long
|| recordnum = Me.CurrentRecord
|| DoCmd.GoToRecord , , acGoTo, recordnum
|| Exit Sub
|| End If
||
|| If I use the MouseWheel and click on another record, or use the PageUp or
|| PageDown key it goes to the edited record. GREAT! However, if I click
| on
|| the cmdClose button the screen doesn't move to the edited record. I've
|| tried using Me.RecordsetClone.AbsolutePosition +1 and
| Me.RecordsetClone.Move
|| Me.SelTop and recordnum = me.SelTop and bookmark and still it doesn't
| move
|| to the edited record.
||
|| What in the world am I missing?
||
|| Debbie
||
||
|| || | Hello Debbie,
|| |
|| | Form has a bookmark property that might help. Also, you can use
|| | RecordsetClone of the form to get more flexibility. I have included the
|| | following article for your reference:
|| |
|| | 128883 ACC2: How to Get "X of Y" from Record Navigation Buttons
|| | http://support.microsoft.com/?id=128883
|| |
|| | 294202 How to enumerate selected form records in Access 2002
|| | http://support.microsoft.com/?id=294202
|| |
|| | Hope this helps.
|| |
|| | Peter Yang
|| | MCSE2000, MCSA, MCDBA
|| | Microsoft Partner Online Support
|| |
|| | Get Secure! - www.microsoft.com/security
|| |
|| | =====================================================
|| | When responding to posts, please "Reply to Group" via
|| | your newsreader so that others may learn and benefit
|| | from your issue.
|| | =====================================================
|| | This posting is provided "AS IS" with no warranties, and confers no
|| rights.
|| |
|| |
|| | --------------------
|| || From: "DebbieG" <[email protected]>
|| || Subject: MouseWheel in Continuous Forms
|| || Date: Tue, 14 Dec 2004 16:08:43 -0600
|| || Lines: 67
|| || X-Priority: 3
|| || X-MSMail-Priority: Normal
|| || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
|| || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
|| || Message-ID: <#[email protected]>
|| || Newsgroups: microsoft.public.access.formscoding
|| || NNTP-Posting-Host: t2p744.stmo2.socket.net 64.85.218.237
|| || Path:
|| |
||
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
|| | phx.gbl!TK2MSFTNGP09.phx.gbl
|| || Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255436
|| || X-Tomcat-NG: microsoft.public.access.formscoding
|| ||
|| || I am using the following code to prevent use of the MouseWheel when
|| | editing
|| || records:
|| ||
|| || There is a textbox on my form called UnboundTextBox.
|| ||
|| || Private mWheel As Boolean
|| || Private validationTrigger As wsTrigger
|| ||
|| || Private Enum wsTrigger
|| || MyWheel = 1
|| || NotTheWheel = 2
|| || End Enum
|| ||
|| || Private Function WheelSpin() As Integer
|| || WheelSpin = mWheel
|| || Select Case validationTrigger
|| || Case NotTheWheel
|| || mWheel = False
|| || End Select
|| || End Function
|| ||
|| || Private Sub Form_Error(DataErr As Integer, Response As Integer)
|| || If Screen.ActiveControl.Name = "UnboundTextBox" Then
|| || Response = acDataErrContinue
|| || End If
|| || End Sub
|| ||
|| || Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As
Long)
|| || On Error GoTo GotError
|| || If Me.Dirty Then
|| || mWheel = True
|| || validationTrigger = MyWheel
|| || Me.UnboundTextBox.SetFocus
|| || Me.UnboundTextBox.Text = " "
|| || End If
|| ||
|| || ExitSub:
|| || validationTrigger = NotTheWheel
|| || Exit Sub
|| ||
|| || GotError:
|| || If Err.Number = 2107 Then
|| || CompleteMsg 'a standard message that they must complete the
|| | edit
|| || Resume ExitSub
|| || End If
|| || MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf &
|| || "Form_MouseWheel"
|| || Resume ExitSub
|| || End Sub
|| ||
|| || This works great on single forms. This makes sense because basically
| the
|| || MouseWheel is similar to PageUp and PageDown.
|| ||
|| || However, when editing on continuous forms, it ALLOWS the scroll and if
|| | the
|| || user clicks on another record, they get the "CompleteMsg" from
|| || Form_BeforeUpdate which is great ... but how can I make it scroll back
| to
|| || the edited record so they don't have to scroll to find it. I don't
| want
|| | to
|| || turn off the MouseWheel completely because that is handy in the
|| | continuous
|| || forms.
|| ||
|| || Is there a way to bookmark the edited record or a way to not allow the
|| || MouseWheel if editing on a continuous form?
|| ||
|| || Thanks,
|| || Debbie
|| ||
|| ||
|| ||
|| |
||
||
||
|
 
P

Peter Yang [MSFT]

Hello Debbie,

I think you may want to consider using a global varaible currentcontrol to
trace the focus of the current control so that you could get back to it
when necessary.

Regards,

Peter Yang
MCSE2000, MCSA, MCDBA
Microsoft Partner Online Support

Get Secure! - www.microsoft.com/security

=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| From: "DebbieG" <[email protected]>
| References: <#[email protected]>
<[email protected]>
<#UW#[email protected]>
<[email protected]>
| Subject: Re: MouseWheel in Continuous Forms
| Date: Thu, 16 Dec 2004 10:34:55 -0600
| Lines: 255
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.access.formscoding
| NNTP-Posting-Host: t1p387.stmo2.socket.net 64.85.215.133
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15
phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255614
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| When I click on cmdClose it knows what the current record is, it just
| doesn't GoTo it.
|
| I found if I GoTo a specific control and then GoTo the current record, it
| works but it goes to a specific field.
|
| This goes to the current record and to a specific control:
|
| Private Sub cmdClose_Click()
| If Me.Dirty Then
| CompleteMsg
| Dim recordnum As Long
| recordnum = Me.CurrentRecord
| DoCmd.GoToControl "DrugScreenCD_combo"
| DoCmd.GoToRecord , "", acGoTo, recordnum
| Exit Sub
| End If
| End Sub
|
| This does nothing:
|
| Private Sub cmdClose_Click()
| If Me.Dirty Then
| CompleteMsg
| Dim recordnum As Long
| recordnum = Me.CurrentRecord
| ' DoCmd.GoToControl "DrugScreenCD_combo"
| DoCmd.GoToRecord , "", acGoTo, recordnum
| Exit Sub
| End If
| End Sub
|
| Is there a way to know which control was active before I clicked on
cmdClose
| and go to it during cmdCose_Click? If this requires a Global variable,
| please be specific in how to code it and where to place the code.
|
| Debbie
|
|
| | | Hello Debbie,
| |
| | This occurs because Me.CurrentRecord is updated when the command click
| | event occurs.
| |
| | I suggest that you define a global variable PreRecordnum, and let it
equal
| | to Me.CurrentRecord whenever it is changed in your own code
| | (orm_BeforeUpdate, Form_KeyDown for PageUp and PageDown). You can use
the
| | following code to go back to previous record in cmdClose button.
| |
| | DoCmd.GoToRecord , , acGoTo, PreRecordnum
| |
| | Hope this information is helpful.
| |
| | Peter Yang
| | MCSE2000, MCSA, MCDBA
| | Microsoft Partner Online Support
| |
| | Get Secure! - www.microsoft.com/security
| |
| | =====================================================
| | When responding to posts, please "Reply to Group" via
| | your newsreader so that others may learn and benefit
| | from your issue.
| | =====================================================
| | This posting is provided "AS IS" with no warranties, and confers no
| rights.
| |
| |
| | --------------------
| || From: "DebbieG" <[email protected]>
| || References: <#[email protected]>
| | <[email protected]>
| || Subject: Re: MouseWheel in Continuous Forms
| || Date: Wed, 15 Dec 2004 03:38:42 -0600
| || Lines: 150
| || X-Priority: 3
| || X-MSMail-Priority: Normal
| || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| || Message-ID: <#UW#[email protected]>
| || Newsgroups: microsoft.public.access.formscoding
| || NNTP-Posting-Host: t1p203.stmo2.socket.net 64.85.214.205
| || Path:
| |
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
| | phx.gbl
| || Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255475
| || X-Tomcat-NG: microsoft.public.access.formscoding
| ||
| || I'm partially successful. I added the following code to
| | Form_BeforeUpdate,
| || Form_KeyDown (for PageUp and PageDown), and on my cmdClose button:
| ||
| || If Me.Dirty Then
| || CompleteMsg - a standard message that user must complete the
| || edited record
| || Dim recordnum As Long
| || recordnum = Me.CurrentRecord
| || DoCmd.GoToRecord , , acGoTo, recordnum
| || Exit Sub
| || End If
| ||
| || If I use the MouseWheel and click on another record, or use the PageUp
or
| || PageDown key it goes to the edited record. GREAT! However, if I click
| | on
| || the cmdClose button the screen doesn't move to the edited record. I've
| || tried using Me.RecordsetClone.AbsolutePosition +1 and
| | Me.RecordsetClone.Move
| || Me.SelTop and recordnum = me.SelTop and bookmark and still it doesn't
| | move
| || to the edited record.
| ||
| || What in the world am I missing?
| ||
| || Debbie
| ||
| ||
| || | || | Hello Debbie,
| || |
| || | Form has a bookmark property that might help. Also, you can use
| || | RecordsetClone of the form to get more flexibility. I have included
the
| || | following article for your reference:
| || |
| || | 128883 ACC2: How to Get "X of Y" from Record Navigation Buttons
| || | http://support.microsoft.com/?id=128883
| || |
| || | 294202 How to enumerate selected form records in Access 2002
| || | http://support.microsoft.com/?id=294202
| || |
| || | Hope this helps.
| || |
| || | Peter Yang
| || | MCSE2000, MCSA, MCDBA
| || | Microsoft Partner Online Support
| || |
| || | Get Secure! - www.microsoft.com/security
| || |
| || | =====================================================
| || | When responding to posts, please "Reply to Group" via
| || | your newsreader so that others may learn and benefit
| || | from your issue.
| || | =====================================================
| || | This posting is provided "AS IS" with no warranties, and confers no
| || rights.
| || |
| || |
| || | --------------------
| || || From: "DebbieG" <[email protected]>
| || || Subject: MouseWheel in Continuous Forms
| || || Date: Tue, 14 Dec 2004 16:08:43 -0600
| || || Lines: 67
| || || X-Priority: 3
| || || X-MSMail-Priority: Normal
| || || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| || || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| || || Message-ID: <#[email protected]>
| || || Newsgroups: microsoft.public.access.formscoding
| || || NNTP-Posting-Host: t2p744.stmo2.socket.net 64.85.218.237
| || || Path:
| || |
| ||
| |
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
| || | phx.gbl!TK2MSFTNGP09.phx.gbl
| || || Xref: cpmsftngxa10.phx.gbl
microsoft.public.access.formscoding:255436
| || || X-Tomcat-NG: microsoft.public.access.formscoding
| || ||
| || || I am using the following code to prevent use of the MouseWheel when
| || | editing
| || || records:
| || ||
| || || There is a textbox on my form called UnboundTextBox.
| || ||
| || || Private mWheel As Boolean
| || || Private validationTrigger As wsTrigger
| || ||
| || || Private Enum wsTrigger
| || || MyWheel = 1
| || || NotTheWheel = 2
| || || End Enum
| || ||
| || || Private Function WheelSpin() As Integer
| || || WheelSpin = mWheel
| || || Select Case validationTrigger
| || || Case NotTheWheel
| || || mWheel = False
| || || End Select
| || || End Function
| || ||
| || || Private Sub Form_Error(DataErr As Integer, Response As Integer)
| || || If Screen.ActiveControl.Name = "UnboundTextBox" Then
| || || Response = acDataErrContinue
| || || End If
| || || End Sub
| || ||
| || || Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As
| Long)
| || || On Error GoTo GotError
| || || If Me.Dirty Then
| || || mWheel = True
| || || validationTrigger = MyWheel
| || || Me.UnboundTextBox.SetFocus
| || || Me.UnboundTextBox.Text = " "
| || || End If
| || ||
| || || ExitSub:
| || || validationTrigger = NotTheWheel
| || || Exit Sub
| || ||
| || || GotError:
| || || If Err.Number = 2107 Then
| || || CompleteMsg 'a standard message that they must complete
the
| || | edit
| || || Resume ExitSub
| || || End If
| || || MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf &
| || || "Form_MouseWheel"
| || || Resume ExitSub
| || || End Sub
| || ||
| || || This works great on single forms. This makes sense because
basically
| | the
| || || MouseWheel is similar to PageUp and PageDown.
| || ||
| || || However, when editing on continuous forms, it ALLOWS the scroll and
if
| || | the
| || || user clicks on another record, they get the "CompleteMsg" from
| || || Form_BeforeUpdate which is great ... but how can I make it scroll
back
| | to
| || || the edited record so they don't have to scroll to find it. I don't
| | want
| || | to
| || || turn off the MouseWheel completely because that is handy in the
| || | continuous
| || || forms.
| || ||
| || || Is there a way to bookmark the edited record or a way to not allow
the
| || || MouseWheel if editing on a continuous form?
| || ||
| || || Thanks,
| || || Debbie
| || ||
| || ||
| || ||
| || |
| ||
| ||
| ||
| |
|
|
|
 
D

DebbieG

Thanks for sticking with me.
Would you please be specific in how to code it and where to place the code.

Thanks,
Debbie

| Hello Debbie,
|
| I think you may want to consider using a global varaible currentcontrol to
| trace the focus of the current control so that you could get back to it
| when necessary.
|
| Regards,
|
| Peter Yang
| MCSE2000, MCSA, MCDBA
| Microsoft Partner Online Support
|
| Get Secure! - www.microsoft.com/security
|
| =====================================================
| When responding to posts, please "Reply to Group" via
| your newsreader so that others may learn and benefit
| from your issue.
| =====================================================
| This posting is provided "AS IS" with no warranties, and confers no
rights.
|
|
| --------------------
|| From: "DebbieG" <[email protected]>
|| References: <#[email protected]>
| <[email protected]>
| <#UW#[email protected]>
| <[email protected]>
|| Subject: Re: MouseWheel in Continuous Forms
|| Date: Thu, 16 Dec 2004 10:34:55 -0600
|| Lines: 255
|| X-Priority: 3
|| X-MSMail-Priority: Normal
|| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
|| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
|| Message-ID: <[email protected]>
|| Newsgroups: microsoft.public.access.formscoding
|| NNTP-Posting-Host: t1p387.stmo2.socket.net 64.85.215.133
|| Path:
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15
| phx.gbl
|| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255614
|| X-Tomcat-NG: microsoft.public.access.formscoding
||
|| When I click on cmdClose it knows what the current record is, it just
|| doesn't GoTo it.
||
|| I found if I GoTo a specific control and then GoTo the current record, it
|| works but it goes to a specific field.
||
|| This goes to the current record and to a specific control:
||
|| Private Sub cmdClose_Click()
|| If Me.Dirty Then
|| CompleteMsg
|| Dim recordnum As Long
|| recordnum = Me.CurrentRecord
|| DoCmd.GoToControl "DrugScreenCD_combo"
|| DoCmd.GoToRecord , "", acGoTo, recordnum
|| Exit Sub
|| End If
|| End Sub
||
|| This does nothing:
||
|| Private Sub cmdClose_Click()
|| If Me.Dirty Then
|| CompleteMsg
|| Dim recordnum As Long
|| recordnum = Me.CurrentRecord
|| ' DoCmd.GoToControl "DrugScreenCD_combo"
|| DoCmd.GoToRecord , "", acGoTo, recordnum
|| Exit Sub
|| End If
|| End Sub
||
|| Is there a way to know which control was active before I clicked on
| cmdClose
|| and go to it during cmdCose_Click? If this requires a Global variable,
|| please be specific in how to code it and where to place the code.
||
|| Debbie
||
||
|| || | Hello Debbie,
|| |
|| | This occurs because Me.CurrentRecord is updated when the command click
|| | event occurs.
|| |
|| | I suggest that you define a global variable PreRecordnum, and let it
| equal
|| | to Me.CurrentRecord whenever it is changed in your own code
|| | (orm_BeforeUpdate, Form_KeyDown for PageUp and PageDown). You can use
| the
|| | following code to go back to previous record in cmdClose button.
|| |
|| | DoCmd.GoToRecord , , acGoTo, PreRecordnum
|| |
|| | Hope this information is helpful.
|| |
|| | Peter Yang
|| | MCSE2000, MCSA, MCDBA
|| | Microsoft Partner Online Support
|| |
|| | Get Secure! - www.microsoft.com/security
|| |
|| | =====================================================
|| | When responding to posts, please "Reply to Group" via
|| | your newsreader so that others may learn and benefit
|| | from your issue.
|| | =====================================================
|| | This posting is provided "AS IS" with no warranties, and confers no
|| rights.
|| |
|| |
|| | --------------------
|| || From: "DebbieG" <[email protected]>
|| || References: <#[email protected]>
|| | <[email protected]>
|| || Subject: Re: MouseWheel in Continuous Forms
|| || Date: Wed, 15 Dec 2004 03:38:42 -0600
|| || Lines: 150
|| || X-Priority: 3
|| || X-MSMail-Priority: Normal
|| || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
|| || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
|| || Message-ID: <#UW#[email protected]>
|| || Newsgroups: microsoft.public.access.formscoding
|| || NNTP-Posting-Host: t1p203.stmo2.socket.net 64.85.214.205
|| || Path:
|| |
||
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
|| | phx.gbl
|| || Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255475
|| || X-Tomcat-NG: microsoft.public.access.formscoding
|| ||
|| || I'm partially successful. I added the following code to
|| | Form_BeforeUpdate,
|| || Form_KeyDown (for PageUp and PageDown), and on my cmdClose button:
|| ||
|| || If Me.Dirty Then
|| || CompleteMsg - a standard message that user must complete
the
|| || edited record
|| || Dim recordnum As Long
|| || recordnum = Me.CurrentRecord
|| || DoCmd.GoToRecord , , acGoTo, recordnum
|| || Exit Sub
|| || End If
|| ||
|| || If I use the MouseWheel and click on another record, or use the PageUp
| or
|| || PageDown key it goes to the edited record. GREAT! However, if I
click
|| | on
|| || the cmdClose button the screen doesn't move to the edited record.
I've
|| || tried using Me.RecordsetClone.AbsolutePosition +1 and
|| | Me.RecordsetClone.Move
|| || Me.SelTop and recordnum = me.SelTop and bookmark and still it doesn't
|| | move
|| || to the edited record.
|| ||
|| || What in the world am I missing?
|| ||
|| || Debbie
|| ||
|| ||
|| || || || | Hello Debbie,
|| || |
|| || | Form has a bookmark property that might help. Also, you can use
|| || | RecordsetClone of the form to get more flexibility. I have included
| the
|| || | following article for your reference:
|| || |
|| || | 128883 ACC2: How to Get "X of Y" from Record Navigation Buttons
|| || | http://support.microsoft.com/?id=128883
|| || |
|| || | 294202 How to enumerate selected form records in Access 2002
|| || | http://support.microsoft.com/?id=294202
|| || |
|| || | Hope this helps.
|| || |
|| || | Peter Yang
|| || | MCSE2000, MCSA, MCDBA
|| || | Microsoft Partner Online Support
|| || |
|| || | Get Secure! - www.microsoft.com/security
|| || |
|| || | =====================================================
|| || | When responding to posts, please "Reply to Group" via
|| || | your newsreader so that others may learn and benefit
|| || | from your issue.
|| || | =====================================================
|| || | This posting is provided "AS IS" with no warranties, and confers no
|| || rights.
|| || |
|| || |
|| || | --------------------
|| || || From: "DebbieG" <[email protected]>
|| || || Subject: MouseWheel in Continuous Forms
|| || || Date: Tue, 14 Dec 2004 16:08:43 -0600
|| || || Lines: 67
|| || || X-Priority: 3
|| || || X-MSMail-Priority: Normal
|| || || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
|| || || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
|| || || Message-ID: <#[email protected]>
|| || || Newsgroups: microsoft.public.access.formscoding
|| || || NNTP-Posting-Host: t2p744.stmo2.socket.net 64.85.218.237
|| || || Path:
|| || |
|| ||
|| |
||
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
|| || | phx.gbl!TK2MSFTNGP09.phx.gbl
|| || || Xref: cpmsftngxa10.phx.gbl
| microsoft.public.access.formscoding:255436
|| || || X-Tomcat-NG: microsoft.public.access.formscoding
|| || ||
|| || || I am using the following code to prevent use of the MouseWheel when
|| || | editing
|| || || records:
|| || ||
|| || || There is a textbox on my form called UnboundTextBox.
|| || ||
|| || || Private mWheel As Boolean
|| || || Private validationTrigger As wsTrigger
|| || ||
|| || || Private Enum wsTrigger
|| || || MyWheel = 1
|| || || NotTheWheel = 2
|| || || End Enum
|| || ||
|| || || Private Function WheelSpin() As Integer
|| || || WheelSpin = mWheel
|| || || Select Case validationTrigger
|| || || Case NotTheWheel
|| || || mWheel = False
|| || || End Select
|| || || End Function
|| || ||
|| || || Private Sub Form_Error(DataErr As Integer, Response As Integer)
|| || || If Screen.ActiveControl.Name = "UnboundTextBox" Then
|| || || Response = acDataErrContinue
|| || || End If
|| || || End Sub
|| || ||
|| || || Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As
|| Long)
|| || || On Error GoTo GotError
|| || || If Me.Dirty Then
|| || || mWheel = True
|| || || validationTrigger = MyWheel
|| || || Me.UnboundTextBox.SetFocus
|| || || Me.UnboundTextBox.Text = " "
|| || || End If
|| || ||
|| || || ExitSub:
|| || || validationTrigger = NotTheWheel
|| || || Exit Sub
|| || ||
|| || || GotError:
|| || || If Err.Number = 2107 Then
|| || || CompleteMsg 'a standard message that they must complete
| the
|| || | edit
|| || || Resume ExitSub
|| || || End If
|| || || MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf &
|| || || "Form_MouseWheel"
|| || || Resume ExitSub
|| || || End Sub
|| || ||
|| || || This works great on single forms. This makes sense because
| basically
|| | the
|| || || MouseWheel is similar to PageUp and PageDown.
|| || ||
|| || || However, when editing on continuous forms, it ALLOWS the scroll and
| if
|| || | the
|| || || user clicks on another record, they get the "CompleteMsg" from
|| || || Form_BeforeUpdate which is great ... but how can I make it scroll
| back
|| | to
|| || || the edited record so they don't have to scroll to find it. I don't
|| | want
|| || | to
|| || || turn off the MouseWheel completely because that is handy in the
|| || | continuous
|| || || forms.
|| || ||
|| || || Is there a way to bookmark the edited record or a way to not allow
| the
|| || || MouseWheel if editing on a continuous form?
|| || ||
|| || || Thanks,
|| || || Debbie
|| || ||
|| || ||
|| || ||
|| || |
|| ||
|| ||
|| ||
|| |
||
||
||
|
 
P

Peter Yang [MSFT]

Hello Debbie,

Thank you for your reply. You could record the current control name by
using Enter event of each control if necessary. The following is a sample

Dim CurrentCtrlName As String

Private Sub Control1_Enter()
CurrentCtrlName = "Control1"
End Sub

Private Sub cmdClose_Click()
If Me.Dirty Then
CompleteMsg
Dim recordnum As Long
recordnum = Me.CurrentRecord
DoCmd.GoToControl CurrentCtrlName
DoCmd.GoToRecord , "", acGoTo, recordnum
Exit Sub
End If
End Sub

Have a great day!

Thanks & Regards,

Peter Yang
MCSE2000, MCSA, MCDBA
Microsoft Partner Online Support

Get Secure! - www.microsoft.com/security

=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| From: "DebbieG" <[email protected]>
| References: <#[email protected]>
<[email protected]>
<#UW#[email protected]>
<[email protected]>
<[email protected]>
<qgCpeU#[email protected]>
| Subject: Re: MouseWheel in Continuous Forms
| Date: Thu, 16 Dec 2004 21:44:18 -0600
| Lines: 331
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <Ov1FNq#[email protected]>
| Newsgroups: microsoft.public.access.formscoding
| NNTP-Posting-Host: t1p015.stmo2.socket.net 64.85.214.17
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255677
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Thanks for sticking with me.
| Would you please be specific in how to code it and where to place the
code.
|
| Thanks,
| Debbie
|
| | | Hello Debbie,
| |
| | I think you may want to consider using a global varaible currentcontrol
to
| | trace the focus of the current control so that you could get back to it
| | when necessary.
| |
| | Regards,
| |
| | Peter Yang
| | MCSE2000, MCSA, MCDBA
| | Microsoft Partner Online Support
| |
| | Get Secure! - www.microsoft.com/security
| |
| | =====================================================
| | When responding to posts, please "Reply to Group" via
| | your newsreader so that others may learn and benefit
| | from your issue.
| | =====================================================
| | This posting is provided "AS IS" with no warranties, and confers no
| rights.
| |
| |
| | --------------------
| || From: "DebbieG" <[email protected]>
| || References: <#[email protected]>
| | <[email protected]>
| | <#UW#[email protected]>
| | <[email protected]>
| || Subject: Re: MouseWheel in Continuous Forms
| || Date: Thu, 16 Dec 2004 10:34:55 -0600
| || Lines: 255
| || X-Priority: 3
| || X-MSMail-Priority: Normal
| || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| || Message-ID: <[email protected]>
| || Newsgroups: microsoft.public.access.formscoding
| || NNTP-Posting-Host: t1p387.stmo2.socket.net 64.85.215.133
| || Path:
| |
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15
| | phx.gbl
| || Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255614
| || X-Tomcat-NG: microsoft.public.access.formscoding
| ||
| || When I click on cmdClose it knows what the current record is, it just
| || doesn't GoTo it.
| ||
| || I found if I GoTo a specific control and then GoTo the current record,
it
| || works but it goes to a specific field.
| ||
| || This goes to the current record and to a specific control:
| ||
| || Private Sub cmdClose_Click()
| || If Me.Dirty Then
| || CompleteMsg
| || Dim recordnum As Long
| || recordnum = Me.CurrentRecord
| || DoCmd.GoToControl "DrugScreenCD_combo"
| || DoCmd.GoToRecord , "", acGoTo, recordnum
| || Exit Sub
| || End If
| || End Sub
| ||
| || This does nothing:
| ||
| || Private Sub cmdClose_Click()
| || If Me.Dirty Then
| || CompleteMsg
| || Dim recordnum As Long
| || recordnum = Me.CurrentRecord
| || ' DoCmd.GoToControl "DrugScreenCD_combo"
| || DoCmd.GoToRecord , "", acGoTo, recordnum
| || Exit Sub
| || End If
| || End Sub
| ||
| || Is there a way to know which control was active before I clicked on
| | cmdClose
| || and go to it during cmdCose_Click? If this requires a Global variable,
| || please be specific in how to code it and where to place the code.
| ||
| || Debbie
| ||
| ||
| || | || | Hello Debbie,
| || |
| || | This occurs because Me.CurrentRecord is updated when the command
click
| || | event occurs.
| || |
| || | I suggest that you define a global variable PreRecordnum, and let it
| | equal
| || | to Me.CurrentRecord whenever it is changed in your own code
| || | (orm_BeforeUpdate, Form_KeyDown for PageUp and PageDown). You can use
| | the
| || | following code to go back to previous record in cmdClose button.
| || |
| || | DoCmd.GoToRecord , , acGoTo, PreRecordnum
| || |
| || | Hope this information is helpful.
| || |
| || | Peter Yang
| || | MCSE2000, MCSA, MCDBA
| || | Microsoft Partner Online Support
| || |
| || | Get Secure! - www.microsoft.com/security
| || |
| || | =====================================================
| || | When responding to posts, please "Reply to Group" via
| || | your newsreader so that others may learn and benefit
| || | from your issue.
| || | =====================================================
| || | This posting is provided "AS IS" with no warranties, and confers no
| || rights.
| || |
| || |
| || | --------------------
| || || From: "DebbieG" <[email protected]>
| || || References: <#[email protected]>
| || | <[email protected]>
| || || Subject: Re: MouseWheel in Continuous Forms
| || || Date: Wed, 15 Dec 2004 03:38:42 -0600
| || || Lines: 150
| || || X-Priority: 3
| || || X-MSMail-Priority: Normal
| || || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| || || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| || || Message-ID: <#UW#[email protected]>
| || || Newsgroups: microsoft.public.access.formscoding
| || || NNTP-Posting-Host: t1p203.stmo2.socket.net 64.85.214.205
| || || Path:
| || |
| ||
| |
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
| || | phx.gbl
| || || Xref: cpmsftngxa10.phx.gbl
microsoft.public.access.formscoding:255475
| || || X-Tomcat-NG: microsoft.public.access.formscoding
| || ||
| || || I'm partially successful. I added the following code to
| || | Form_BeforeUpdate,
| || || Form_KeyDown (for PageUp and PageDown), and on my cmdClose button:
| || ||
| || || If Me.Dirty Then
| || || CompleteMsg - a standard message that user must complete
| the
| || || edited record
| || || Dim recordnum As Long
| || || recordnum = Me.CurrentRecord
| || || DoCmd.GoToRecord , , acGoTo, recordnum
| || || Exit Sub
| || || End If
| || ||
| || || If I use the MouseWheel and click on another record, or use the
PageUp
| | or
| || || PageDown key it goes to the edited record. GREAT! However, if I
| click
| || | on
| || || the cmdClose button the screen doesn't move to the edited record.
| I've
| || || tried using Me.RecordsetClone.AbsolutePosition +1 and
| || | Me.RecordsetClone.Move
| || || Me.SelTop and recordnum = me.SelTop and bookmark and still it
doesn't
| || | move
| || || to the edited record.
| || ||
| || || What in the world am I missing?
| || ||
| || || Debbie
| || ||
| || ||
| || || | || || | Hello Debbie,
| || || |
| || || | Form has a bookmark property that might help. Also, you can use
| || || | RecordsetClone of the form to get more flexibility. I have
included
| | the
| || || | following article for your reference:
| || || |
| || || | 128883 ACC2: How to Get "X of Y" from Record Navigation Buttons
| || || | http://support.microsoft.com/?id=128883
| || || |
| || || | 294202 How to enumerate selected form records in Access 2002
| || || | http://support.microsoft.com/?id=294202
| || || |
| || || | Hope this helps.
| || || |
| || || | Peter Yang
| || || | MCSE2000, MCSA, MCDBA
| || || | Microsoft Partner Online Support
| || || |
| || || | Get Secure! - www.microsoft.com/security
| || || |
| || || | =====================================================
| || || | When responding to posts, please "Reply to Group" via
| || || | your newsreader so that others may learn and benefit
| || || | from your issue.
| || || | =====================================================
| || || | This posting is provided "AS IS" with no warranties, and confers
no
| || || rights.
| || || |
| || || |
| || || | --------------------
| || || || From: "DebbieG" <[email protected]>
| || || || Subject: MouseWheel in Continuous Forms
| || || || Date: Tue, 14 Dec 2004 16:08:43 -0600
| || || || Lines: 67
| || || || X-Priority: 3
| || || || X-MSMail-Priority: Normal
| || || || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| || || || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| || || || Message-ID: <#[email protected]>
| || || || Newsgroups: microsoft.public.access.formscoding
| || || || NNTP-Posting-Host: t2p744.stmo2.socket.net 64.85.218.237
| || || || Path:
| || || |
| || ||
| || |
| ||
| |
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
| || || | phx.gbl!TK2MSFTNGP09.phx.gbl
| || || || Xref: cpmsftngxa10.phx.gbl
| | microsoft.public.access.formscoding:255436
| || || || X-Tomcat-NG: microsoft.public.access.formscoding
| || || ||
| || || || I am using the following code to prevent use of the MouseWheel
when
| || || | editing
| || || || records:
| || || ||
| || || || There is a textbox on my form called UnboundTextBox.
| || || ||
| || || || Private mWheel As Boolean
| || || || Private validationTrigger As wsTrigger
| || || ||
| || || || Private Enum wsTrigger
| || || || MyWheel = 1
| || || || NotTheWheel = 2
| || || || End Enum
| || || ||
| || || || Private Function WheelSpin() As Integer
| || || || WheelSpin = mWheel
| || || || Select Case validationTrigger
| || || || Case NotTheWheel
| || || || mWheel = False
| || || || End Select
| || || || End Function
| || || ||
| || || || Private Sub Form_Error(DataErr As Integer, Response As Integer)
| || || || If Screen.ActiveControl.Name = "UnboundTextBox" Then
| || || || Response = acDataErrContinue
| || || || End If
| || || || End Sub
| || || ||
| || || || Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As
| || Long)
| || || || On Error GoTo GotError
| || || || If Me.Dirty Then
| || || || mWheel = True
| || || || validationTrigger = MyWheel
| || || || Me.UnboundTextBox.SetFocus
| || || || Me.UnboundTextBox.Text = " "
| || || || End If
| || || ||
| || || || ExitSub:
| || || || validationTrigger = NotTheWheel
| || || || Exit Sub
| || || ||
| || || || GotError:
| || || || If Err.Number = 2107 Then
| || || || CompleteMsg 'a standard message that they must
complete
| | the
| || || | edit
| || || || Resume ExitSub
| || || || End If
| || || || MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf &
| || || || "Form_MouseWheel"
| || || || Resume ExitSub
| || || || End Sub
| || || ||
| || || || This works great on single forms. This makes sense because
| | basically
| || | the
| || || || MouseWheel is similar to PageUp and PageDown.
| || || ||
| || || || However, when editing on continuous forms, it ALLOWS the scroll
and
| | if
| || || | the
| || || || user clicks on another record, they get the "CompleteMsg" from
| || || || Form_BeforeUpdate which is great ... but how can I make it scroll
| | back
| || | to
| || || || the edited record so they don't have to scroll to find it. I
don't
| || | want
| || || | to
| || || || turn off the MouseWheel completely because that is handy in the
| || || | continuous
| || || || forms.
| || || ||
| || || || Is there a way to bookmark the edited record or a way to not
allow
| | the
| || || || MouseWheel if editing on a continuous form?
| || || ||
| || || || Thanks,
| || || || Debbie
| || || ||
| || || ||
| || || ||
| || || |
| || ||
| || ||
| || ||
| || |
| ||
| ||
| ||
| |
|
|
|
 
D

DebbieG

I am smiling!!!!! That works exactly as I wanted. I really appreciate your
help.

Thank you,
Debbie


| Hello Debbie,
|
| Thank you for your reply. You could record the current control name by
| using Enter event of each control if necessary. The following is a sample
|
| Dim CurrentCtrlName As String
|
| Private Sub Control1_Enter()
| CurrentCtrlName = "Control1"
| End Sub
|
| Private Sub cmdClose_Click()
| If Me.Dirty Then
| CompleteMsg
| Dim recordnum As Long
| recordnum = Me.CurrentRecord
| DoCmd.GoToControl CurrentCtrlName
| DoCmd.GoToRecord , "", acGoTo, recordnum
| Exit Sub
| End If
| End Sub
|
| Have a great day!
|
| Thanks & Regards,
|
| Peter Yang
| MCSE2000, MCSA, MCDBA
| Microsoft Partner Online Support
|
| Get Secure! - www.microsoft.com/security
|
| =====================================================
| When responding to posts, please "Reply to Group" via
| your newsreader so that others may learn and benefit
| from your issue.
| =====================================================
| This posting is provided "AS IS" with no warranties, and confers no
rights.
|
|
| --------------------
|| From: "DebbieG" <[email protected]>
|| References: <#[email protected]>
| <[email protected]>
| <#UW#[email protected]>
| <[email protected]>
| <[email protected]>
| <qgCpeU#[email protected]>
|| Subject: Re: MouseWheel in Continuous Forms
|| Date: Thu, 16 Dec 2004 21:44:18 -0600
|| Lines: 331
|| X-Priority: 3
|| X-MSMail-Priority: Normal
|| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
|| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
|| Message-ID: <Ov1FNq#[email protected]>
|| Newsgroups: microsoft.public.access.formscoding
|| NNTP-Posting-Host: t1p015.stmo2.socket.net 64.85.214.17
|| Path:
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
| phx.gbl
|| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255677
|| X-Tomcat-NG: microsoft.public.access.formscoding
||
|| Thanks for sticking with me.
|| Would you please be specific in how to code it and where to place the
| code.
||
|| Thanks,
|| Debbie
||
|| || | Hello Debbie,
|| |
|| | I think you may want to consider using a global varaible currentcontrol
| to
|| | trace the focus of the current control so that you could get back to it
|| | when necessary.
|| |
|| | Regards,
|| |
|| | Peter Yang
|| | MCSE2000, MCSA, MCDBA
|| | Microsoft Partner Online Support
|| |
|| | Get Secure! - www.microsoft.com/security
|| |
|| | =====================================================
|| | When responding to posts, please "Reply to Group" via
|| | your newsreader so that others may learn and benefit
|| | from your issue.
|| | =====================================================
|| | This posting is provided "AS IS" with no warranties, and confers no
|| rights.
|| |
|| |
|| | --------------------
|| || From: "DebbieG" <[email protected]>
|| || References: <#[email protected]>
|| | <[email protected]>
|| | <#UW#[email protected]>
|| | <[email protected]>
|| || Subject: Re: MouseWheel in Continuous Forms
|| || Date: Thu, 16 Dec 2004 10:34:55 -0600
|| || Lines: 255
|| || X-Priority: 3
|| || X-MSMail-Priority: Normal
|| || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
|| || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
|| || Message-ID: <[email protected]>
|| || Newsgroups: microsoft.public.access.formscoding
|| || NNTP-Posting-Host: t1p387.stmo2.socket.net 64.85.215.133
|| || Path:
|| |
||
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15
|| | phx.gbl
|| || Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255614
|| || X-Tomcat-NG: microsoft.public.access.formscoding
|| ||
|| || When I click on cmdClose it knows what the current record is, it just
|| || doesn't GoTo it.
|| ||
|| || I found if I GoTo a specific control and then GoTo the current record,
| it
|| || works but it goes to a specific field.
|| ||
|| || This goes to the current record and to a specific control:
|| ||
|| || Private Sub cmdClose_Click()
|| || If Me.Dirty Then
|| || CompleteMsg
|| || Dim recordnum As Long
|| || recordnum = Me.CurrentRecord
|| || DoCmd.GoToControl "DrugScreenCD_combo"
|| || DoCmd.GoToRecord , "", acGoTo, recordnum
|| || Exit Sub
|| || End If
|| || End Sub
|| ||
|| || This does nothing:
|| ||
|| || Private Sub cmdClose_Click()
|| || If Me.Dirty Then
|| || CompleteMsg
|| || Dim recordnum As Long
|| || recordnum = Me.CurrentRecord
|| || ' DoCmd.GoToControl "DrugScreenCD_combo"
|| || DoCmd.GoToRecord , "", acGoTo, recordnum
|| || Exit Sub
|| || End If
|| || End Sub
|| ||
|| || Is there a way to know which control was active before I clicked on
|| | cmdClose
|| || and go to it during cmdCose_Click? If this requires a Global
variable,
|| || please be specific in how to code it and where to place the code.
|| ||
|| || Debbie
|| ||
|| ||
|| || || || | Hello Debbie,
|| || |
|| || | This occurs because Me.CurrentRecord is updated when the command
| click
|| || | event occurs.
|| || |
|| || | I suggest that you define a global variable PreRecordnum, and let it
|| | equal
|| || | to Me.CurrentRecord whenever it is changed in your own code
|| || | (orm_BeforeUpdate, Form_KeyDown for PageUp and PageDown). You can
use
|| | the
|| || | following code to go back to previous record in cmdClose button.
|| || |
|| || | DoCmd.GoToRecord , , acGoTo, PreRecordnum
|| || |
|| || | Hope this information is helpful.
|| || |
|| || | Peter Yang
|| || | MCSE2000, MCSA, MCDBA
|| || | Microsoft Partner Online Support
|| || |
|| || | Get Secure! - www.microsoft.com/security
|| || |
|| || | =====================================================
|| || | When responding to posts, please "Reply to Group" via
|| || | your newsreader so that others may learn and benefit
|| || | from your issue.
|| || | =====================================================
|| || | This posting is provided "AS IS" with no warranties, and confers no
|| || rights.
|| || |
|| || |
|| || | --------------------
|| || || From: "DebbieG" <[email protected]>
|| || || References: <#[email protected]>
|| || | <[email protected]>
|| || || Subject: Re: MouseWheel in Continuous Forms
|| || || Date: Wed, 15 Dec 2004 03:38:42 -0600
|| || || Lines: 150
|| || || X-Priority: 3
|| || || X-MSMail-Priority: Normal
|| || || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
|| || || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
|| || || Message-ID: <#UW#[email protected]>
|| || || Newsgroups: microsoft.public.access.formscoding
|| || || NNTP-Posting-Host: t1p203.stmo2.socket.net 64.85.214.205
|| || || Path:
|| || |
|| ||
|| |
||
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
|| || | phx.gbl
|| || || Xref: cpmsftngxa10.phx.gbl
| microsoft.public.access.formscoding:255475
|| || || X-Tomcat-NG: microsoft.public.access.formscoding
|| || ||
|| || || I'm partially successful. I added the following code to
|| || | Form_BeforeUpdate,
|| || || Form_KeyDown (for PageUp and PageDown), and on my cmdClose button:
|| || ||
|| || || If Me.Dirty Then
|| || || CompleteMsg - a standard message that user must complete
|| the
|| || || edited record
|| || || Dim recordnum As Long
|| || || recordnum = Me.CurrentRecord
|| || || DoCmd.GoToRecord , , acGoTo, recordnum
|| || || Exit Sub
|| || || End If
|| || ||
|| || || If I use the MouseWheel and click on another record, or use the
| PageUp
|| | or
|| || || PageDown key it goes to the edited record. GREAT! However, if I
|| click
|| || | on
|| || || the cmdClose button the screen doesn't move to the edited record.
|| I've
|| || || tried using Me.RecordsetClone.AbsolutePosition +1 and
|| || | Me.RecordsetClone.Move
|| || || Me.SelTop and recordnum = me.SelTop and bookmark and still it
| doesn't
|| || | move
|| || || to the edited record.
|| || ||
|| || || What in the world am I missing?
|| || ||
|| || || Debbie
|| || ||
|| || ||
|| || || || || || | Hello Debbie,
|| || || |
|| || || | Form has a bookmark property that might help. Also, you can use
|| || || | RecordsetClone of the form to get more flexibility. I have
| included
|| | the
|| || || | following article for your reference:
|| || || |
|| || || | 128883 ACC2: How to Get "X of Y" from Record Navigation Buttons
|| || || | http://support.microsoft.com/?id=128883
|| || || |
|| || || | 294202 How to enumerate selected form records in Access 2002
|| || || | http://support.microsoft.com/?id=294202
|| || || |
|| || || | Hope this helps.
|| || || |
|| || || | Peter Yang
|| || || | MCSE2000, MCSA, MCDBA
|| || || | Microsoft Partner Online Support
|| || || |
|| || || | Get Secure! - www.microsoft.com/security
|| || || |
|| || || | =====================================================
|| || || | When responding to posts, please "Reply to Group" via
|| || || | your newsreader so that others may learn and benefit
|| || || | from your issue.
|| || || | =====================================================
|| || || | This posting is provided "AS IS" with no warranties, and confers
| no
|| || || rights.
|| || || |
|| || || |
|| || || | --------------------
|| || || || From: "DebbieG" <[email protected]>
|| || || || Subject: MouseWheel in Continuous Forms
|| || || || Date: Tue, 14 Dec 2004 16:08:43 -0600
|| || || || Lines: 67
|| || || || X-Priority: 3
|| || || || X-MSMail-Priority: Normal
|| || || || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
|| || || || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
|| || || || Message-ID: <#[email protected]>
|| || || || Newsgroups: microsoft.public.access.formscoding
|| || || || NNTP-Posting-Host: t2p744.stmo2.socket.net 64.85.218.237
|| || || || Path:
|| || || |
|| || ||
|| || |
|| ||
|| |
||
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
|| || || | phx.gbl!TK2MSFTNGP09.phx.gbl
|| || || || Xref: cpmsftngxa10.phx.gbl
|| | microsoft.public.access.formscoding:255436
|| || || || X-Tomcat-NG: microsoft.public.access.formscoding
|| || || ||
|| || || || I am using the following code to prevent use of the MouseWheel
| when
|| || || | editing
|| || || || records:
|| || || ||
|| || || || There is a textbox on my form called UnboundTextBox.
|| || || ||
|| || || || Private mWheel As Boolean
|| || || || Private validationTrigger As wsTrigger
|| || || ||
|| || || || Private Enum wsTrigger
|| || || || MyWheel = 1
|| || || || NotTheWheel = 2
|| || || || End Enum
|| || || ||
|| || || || Private Function WheelSpin() As Integer
|| || || || WheelSpin = mWheel
|| || || || Select Case validationTrigger
|| || || || Case NotTheWheel
|| || || || mWheel = False
|| || || || End Select
|| || || || End Function
|| || || ||
|| || || || Private Sub Form_Error(DataErr As Integer, Response As Integer)
|| || || || If Screen.ActiveControl.Name = "UnboundTextBox" Then
|| || || || Response = acDataErrContinue
|| || || || End If
|| || || || End Sub
|| || || ||
|| || || || Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count
As
|| || Long)
|| || || || On Error GoTo GotError
|| || || || If Me.Dirty Then
|| || || || mWheel = True
|| || || || validationTrigger = MyWheel
|| || || || Me.UnboundTextBox.SetFocus
|| || || || Me.UnboundTextBox.Text = " "
|| || || || End If
|| || || ||
|| || || || ExitSub:
|| || || || validationTrigger = NotTheWheel
|| || || || Exit Sub
|| || || ||
|| || || || GotError:
|| || || || If Err.Number = 2107 Then
|| || || || CompleteMsg 'a standard message that they must
| complete
|| | the
|| || || | edit
|| || || || Resume ExitSub
|| || || || End If
|| || || || MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf &
|| || || || "Form_MouseWheel"
|| || || || Resume ExitSub
|| || || || End Sub
|| || || ||
|| || || || This works great on single forms. This makes sense because
|| | basically
|| || | the
|| || || || MouseWheel is similar to PageUp and PageDown.
|| || || ||
|| || || || However, when editing on continuous forms, it ALLOWS the scroll
| and
|| | if
|| || || | the
|| || || || user clicks on another record, they get the "CompleteMsg" from
|| || || || Form_BeforeUpdate which is great ... but how can I make it
scroll
|| | back
|| || | to
|| || || || the edited record so they don't have to scroll to find it. I
| don't
|| || | want
|| || || | to
|| || || || turn off the MouseWheel completely because that is handy in the
|| || || | continuous
|| || || || forms.
|| || || ||
|| || || || Is there a way to bookmark the edited record or a way to not
| allow
|| | the
|| || || || MouseWheel if editing on a continuous form?
|| || || ||
|| || || || Thanks,
|| || || || Debbie
|| || || ||
|| || || ||
|| || || ||
|| || || |
|| || ||
|| || ||
|| || ||
|| || |
|| ||
|| ||
|| ||
|| |
||
||
||
|
 
P

Peter Yang [MSFT]

Hello Debbie,

Glad to hear the issue is resolved!

Thanks & Regards,

Peter Yang
MCSE2000, MCSA, MCDBA
Microsoft Partner Online Support

Get Secure! - www.microsoft.com/security

=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
| From: "DebbieG" <[email protected]>
| References: <#[email protected]>
<[email protected]>
<#UW#[email protected]>
<[email protected]>
<[email protected]>
<qgCpeU#[email protected]>
<Ov1FNq#[email protected]>
<[email protected]>
| Subject: Re: MouseWheel in Continuous Forms
| Date: Fri, 17 Dec 2004 01:55:02 -0600
| Lines: 434
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.access.formscoding
| NNTP-Posting-Host: t1p015.stmo2.socket.net 64.85.214.17
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255690
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| I am smiling!!!!! That works exactly as I wanted. I really appreciate
your
| help.
|
| Thank you,
| Debbie
|
|
| | | Hello Debbie,
| |
| | Thank you for your reply. You could record the current control name by
| | using Enter event of each control if necessary. The following is a
sample
| |
| | Dim CurrentCtrlName As String
| |
| | Private Sub Control1_Enter()
| | CurrentCtrlName = "Control1"
| | End Sub
| |
| | Private Sub cmdClose_Click()
| | If Me.Dirty Then
| | CompleteMsg
| | Dim recordnum As Long
| | recordnum = Me.CurrentRecord
| | DoCmd.GoToControl CurrentCtrlName
| | DoCmd.GoToRecord , "", acGoTo, recordnum
| | Exit Sub
| | End If
| | End Sub
| |
| | Have a great day!
| |
| | Thanks & Regards,
| |
| | Peter Yang
| | MCSE2000, MCSA, MCDBA
| | Microsoft Partner Online Support
| |
| | Get Secure! - www.microsoft.com/security
| |
| | =====================================================
| | When responding to posts, please "Reply to Group" via
| | your newsreader so that others may learn and benefit
| | from your issue.
| | =====================================================
| | This posting is provided "AS IS" with no warranties, and confers no
| rights.
| |
| |
| | --------------------
| || From: "DebbieG" <[email protected]>
| || References: <#[email protected]>
| | <[email protected]>
| | <#UW#[email protected]>
| | <[email protected]>
| | <[email protected]>
| | <qgCpeU#[email protected]>
| || Subject: Re: MouseWheel in Continuous Forms
| || Date: Thu, 16 Dec 2004 21:44:18 -0600
| || Lines: 331
| || X-Priority: 3
| || X-MSMail-Priority: Normal
| || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| || Message-ID: <Ov1FNq#[email protected]>
| || Newsgroups: microsoft.public.access.formscoding
| || NNTP-Posting-Host: t1p015.stmo2.socket.net 64.85.214.17
| || Path:
| |
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
| | phx.gbl
| || Xref: cpmsftngxa10.phx.gbl microsoft.public.access.formscoding:255677
| || X-Tomcat-NG: microsoft.public.access.formscoding
| ||
| || Thanks for sticking with me.
| || Would you please be specific in how to code it and where to place the
| | code.
| ||
| || Thanks,
| || Debbie
| ||
| || | || | Hello Debbie,
| || |
| || | I think you may want to consider using a global varaible
currentcontrol
| | to
| || | trace the focus of the current control so that you could get back to
it
| || | when necessary.
| || |
| || | Regards,
| || |
| || | Peter Yang
| || | MCSE2000, MCSA, MCDBA
| || | Microsoft Partner Online Support
| || |
| || | Get Secure! - www.microsoft.com/security
| || |
| || | =====================================================
| || | When responding to posts, please "Reply to Group" via
| || | your newsreader so that others may learn and benefit
| || | from your issue.
| || | =====================================================
| || | This posting is provided "AS IS" with no warranties, and confers no
| || rights.
| || |
| || |
| || | --------------------
| || || From: "DebbieG" <[email protected]>
| || || References: <#[email protected]>
| || | <[email protected]>
| || | <#UW#[email protected]>
| || | <[email protected]>
| || || Subject: Re: MouseWheel in Continuous Forms
| || || Date: Thu, 16 Dec 2004 10:34:55 -0600
| || || Lines: 255
| || || X-Priority: 3
| || || X-MSMail-Priority: Normal
| || || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| || || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| || || Message-ID: <[email protected]>
| || || Newsgroups: microsoft.public.access.formscoding
| || || NNTP-Posting-Host: t1p387.stmo2.socket.net 64.85.215.133
| || || Path:
| || |
| ||
| |
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15
| || | phx.gbl
| || || Xref: cpmsftngxa10.phx.gbl
microsoft.public.access.formscoding:255614
| || || X-Tomcat-NG: microsoft.public.access.formscoding
| || ||
| || || When I click on cmdClose it knows what the current record is, it
just
| || || doesn't GoTo it.
| || ||
| || || I found if I GoTo a specific control and then GoTo the current
record,
| | it
| || || works but it goes to a specific field.
| || ||
| || || This goes to the current record and to a specific control:
| || ||
| || || Private Sub cmdClose_Click()
| || || If Me.Dirty Then
| || || CompleteMsg
| || || Dim recordnum As Long
| || || recordnum = Me.CurrentRecord
| || || DoCmd.GoToControl "DrugScreenCD_combo"
| || || DoCmd.GoToRecord , "", acGoTo, recordnum
| || || Exit Sub
| || || End If
| || || End Sub
| || ||
| || || This does nothing:
| || ||
| || || Private Sub cmdClose_Click()
| || || If Me.Dirty Then
| || || CompleteMsg
| || || Dim recordnum As Long
| || || recordnum = Me.CurrentRecord
| || || ' DoCmd.GoToControl "DrugScreenCD_combo"
| || || DoCmd.GoToRecord , "", acGoTo, recordnum
| || || Exit Sub
| || || End If
| || || End Sub
| || ||
| || || Is there a way to know which control was active before I clicked on
| || | cmdClose
| || || and go to it during cmdCose_Click? If this requires a Global
| variable,
| || || please be specific in how to code it and where to place the code.
| || ||
| || || Debbie
| || ||
| || ||
| || || | || || | Hello Debbie,
| || || |
| || || | This occurs because Me.CurrentRecord is updated when the command
| | click
| || || | event occurs.
| || || |
| || || | I suggest that you define a global variable PreRecordnum, and let
it
| || | equal
| || || | to Me.CurrentRecord whenever it is changed in your own code
| || || | (orm_BeforeUpdate, Form_KeyDown for PageUp and PageDown). You can
| use
| || | the
| || || | following code to go back to previous record in cmdClose button.
| || || |
| || || | DoCmd.GoToRecord , , acGoTo, PreRecordnum
| || || |
| || || | Hope this information is helpful.
| || || |
| || || | Peter Yang
| || || | MCSE2000, MCSA, MCDBA
| || || | Microsoft Partner Online Support
| || || |
| || || | Get Secure! - www.microsoft.com/security
| || || |
| || || | =====================================================
| || || | When responding to posts, please "Reply to Group" via
| || || | your newsreader so that others may learn and benefit
| || || | from your issue.
| || || | =====================================================
| || || | This posting is provided "AS IS" with no warranties, and confers
no
| || || rights.
| || || |
| || || |
| || || | --------------------
| || || || From: "DebbieG" <[email protected]>
| || || || References: <#[email protected]>
| || || | <[email protected]>
| || || || Subject: Re: MouseWheel in Continuous Forms
| || || || Date: Wed, 15 Dec 2004 03:38:42 -0600
| || || || Lines: 150
| || || || X-Priority: 3
| || || || X-MSMail-Priority: Normal
| || || || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| || || || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| || || || Message-ID: <#UW#[email protected]>
| || || || Newsgroups: microsoft.public.access.formscoding
| || || || NNTP-Posting-Host: t1p203.stmo2.socket.net 64.85.214.205
| || || || Path:
| || || |
| || ||
| || |
| ||
| |
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
| || || | phx.gbl
| || || || Xref: cpmsftngxa10.phx.gbl
| | microsoft.public.access.formscoding:255475
| || || || X-Tomcat-NG: microsoft.public.access.formscoding
| || || ||
| || || || I'm partially successful. I added the following code to
| || || | Form_BeforeUpdate,
| || || || Form_KeyDown (for PageUp and PageDown), and on my cmdClose
button:
| || || ||
| || || || If Me.Dirty Then
| || || || CompleteMsg - a standard message that user must
complete
| || the
| || || || edited record
| || || || Dim recordnum As Long
| || || || recordnum = Me.CurrentRecord
| || || || DoCmd.GoToRecord , , acGoTo, recordnum
| || || || Exit Sub
| || || || End If
| || || ||
| || || || If I use the MouseWheel and click on another record, or use the
| | PageUp
| || | or
| || || || PageDown key it goes to the edited record. GREAT! However, if I
| || click
| || || | on
| || || || the cmdClose button the screen doesn't move to the edited record.
| || I've
| || || || tried using Me.RecordsetClone.AbsolutePosition +1 and
| || || | Me.RecordsetClone.Move
| || || || Me.SelTop and recordnum = me.SelTop and bookmark and still it
| | doesn't
| || || | move
| || || || to the edited record.
| || || ||
| || || || What in the world am I missing?
| || || ||
| || || || Debbie
| || || ||
| || || ||
message
| || || || | || || || | Hello Debbie,
| || || || |
| || || || | Form has a bookmark property that might help. Also, you can use
| || || || | RecordsetClone of the form to get more flexibility. I have
| | included
| || | the
| || || || | following article for your reference:
| || || || |
| || || || | 128883 ACC2: How to Get "X of Y" from Record Navigation Buttons
| || || || | http://support.microsoft.com/?id=128883
| || || || |
| || || || | 294202 How to enumerate selected form records in Access 2002
| || || || | http://support.microsoft.com/?id=294202
| || || || |
| || || || | Hope this helps.
| || || || |
| || || || | Peter Yang
| || || || | MCSE2000, MCSA, MCDBA
| || || || | Microsoft Partner Online Support
| || || || |
| || || || | Get Secure! - www.microsoft.com/security
| || || || |
| || || || | =====================================================
| || || || | When responding to posts, please "Reply to Group" via
| || || || | your newsreader so that others may learn and benefit
| || || || | from your issue.
| || || || | =====================================================
| || || || | This posting is provided "AS IS" with no warranties, and
confers
| | no
| || || || rights.
| || || || |
| || || || |
| || || || | --------------------
| || || || || From: "DebbieG" <[email protected]>
| || || || || Subject: MouseWheel in Continuous Forms
| || || || || Date: Tue, 14 Dec 2004 16:08:43 -0600
| || || || || Lines: 67
| || || || || X-Priority: 3
| || || || || X-MSMail-Priority: Normal
| || || || || X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| || || || || X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| || || || || Message-ID: <#[email protected]>
| || || || || Newsgroups: microsoft.public.access.formscoding
| || || || || NNTP-Posting-Host: t2p744.stmo2.socket.net 64.85.218.237
| || || || || Path:
| || || || |
| || || ||
| || || |
| || ||
| || |
| ||
| |
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
| || || || | phx.gbl!TK2MSFTNGP09.phx.gbl
| || || || || Xref: cpmsftngxa10.phx.gbl
| || | microsoft.public.access.formscoding:255436
| || || || || X-Tomcat-NG: microsoft.public.access.formscoding
| || || || ||
| || || || || I am using the following code to prevent use of the MouseWheel
| | when
| || || || | editing
| || || || || records:
| || || || ||
| || || || || There is a textbox on my form called UnboundTextBox.
| || || || ||
| || || || || Private mWheel As Boolean
| || || || || Private validationTrigger As wsTrigger
| || || || ||
| || || || || Private Enum wsTrigger
| || || || || MyWheel = 1
| || || || || NotTheWheel = 2
| || || || || End Enum
| || || || ||
| || || || || Private Function WheelSpin() As Integer
| || || || || WheelSpin = mWheel
| || || || || Select Case validationTrigger
| || || || || Case NotTheWheel
| || || || || mWheel = False
| || || || || End Select
| || || || || End Function
| || || || ||
| || || || || Private Sub Form_Error(DataErr As Integer, Response As
Integer)
| || || || || If Screen.ActiveControl.Name = "UnboundTextBox" Then
| || || || || Response = acDataErrContinue
| || || || || End If
| || || || || End Sub
| || || || ||
| || || || || Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal
Count
| As
| || || Long)
| || || || || On Error GoTo GotError
| || || || || If Me.Dirty Then
| || || || || mWheel = True
| || || || || validationTrigger = MyWheel
| || || || || Me.UnboundTextBox.SetFocus
| || || || || Me.UnboundTextBox.Text = " "
| || || || || End If
| || || || ||
| || || || || ExitSub:
| || || || || validationTrigger = NotTheWheel
| || || || || Exit Sub
| || || || ||
| || || || || GotError:
| || || || || If Err.Number = 2107 Then
| || || || || CompleteMsg 'a standard message that they must
| | complete
| || | the
| || || || | edit
| || || || || Resume ExitSub
| || || || || End If
| || || || || MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf &
| || || || || "Form_MouseWheel"
| || || || || Resume ExitSub
| || || || || End Sub
| || || || ||
| || || || || This works great on single forms. This makes sense because
| || | basically
| || || | the
| || || || || MouseWheel is similar to PageUp and PageDown.
| || || || ||
| || || || || However, when editing on continuous forms, it ALLOWS the
scroll
| | and
| || | if
| || || || | the
| || || || || user clicks on another record, they get the "CompleteMsg" from
| || || || || Form_BeforeUpdate which is great ... but how can I make it
| scroll
| || | back
| || || | to
| || || || || the edited record so they don't have to scroll to find it. I
| | don't
| || || | want
| || || || | to
| || || || || turn off the MouseWheel completely because that is handy in
the
| || || || | continuous
| || || || || forms.
| || || || ||
| || || || || Is there a way to bookmark the edited record or a way to not
| | allow
| || | the
| || || || || MouseWheel if editing on a continuous form?
| || || || ||
| || || || || Thanks,
| || || || || Debbie
| || || || ||
| || || || ||
| || || || ||
| || || || |
| || || ||
| || || ||
| || || ||
| || || |
| || ||
| || ||
| || ||
| || |
| ||
| ||
| ||
| |
|
|
|
 

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