Record selection

T

Tony Nichols

Can anyone tell me if it is possible to disable the mouse
wheel from record navigation in a form.

I want to remove the ability of the user to move to a
different record using any intrinsic functionality. I
want to review field values in the current record before
allowing the record to be saved to the table.

I will build command buttons to advance to new
records.

Thanks in advance for any assistance.

Thanks Brendan and Ken for the information on the list
box functionality.

Tony Nichols
 
D

Dirk Goldgar

Tony Nichols said:
Can anyone tell me if it is possible to disable the mouse
wheel from record navigation in a form.

I want to remove the ability of the user to move to a
different record using any intrinsic functionality. I
want to review field values in the current record before
allowing the record to be saved to the table.

I will build command buttons to advance to new
records.

Thanks in advance for any assistance.

Thanks Brendan and Ken for the information on the list
box functionality.

Tony Nichols

Stephen Lebans has provided a way to disable the mouse wheel at this
site:

www.lebans.com\mousewheelonoff.htm

Even without that, you can control whether modified records get saved or
not by putting code in the form's BeforeUpdate event that will cancel
that event unless the field values meet your standards. That won't keep
the user from scrolling freely through *unmodified* records, though.
However, if your intention is to validate modified records, the form's
BeforeUpdate is where your validation code belongs.
 
G

Guest

Thanks Dirk for the tip.

Your comments got me thinking about the next step and I
am not sure how to handle the cancel save if the
validation does not meet requirements. That is if a
field has changed value and I do not want to save the
record what is the best method to return beforeupdate
value?

Thanks in advance for any assistance.

Tony Nichols
 
D

Dirk Goldgar

Thanks Dirk for the tip.

Your comments got me thinking about the next step and I
am not sure how to handle the cancel save if the
validation does not meet requirements. That is if a
field has changed value and I do not want to save the
record what is the best method to return beforeupdate
value?

If you cancel the BeforeUpdate event, by setting the event procedure's
Cancel argument to true before exiting the procedure, then the form will
not move to the next record, or close, or do whatever you tried to do
that caused Access to attempt to save the record. If you also want to
undo all the changes made to the current record, you can call the form's
Undo method; e.g.,

Private Sub Form_BeforeUpdate(Cancel As Integer)

If (... some undesirable condition is true ...) Then
MsgBox "No way!"
Cancel = True
Me.Undo
End If

End Sub

You can also validate any individual control in its own BeforeUpdate
event, and cancel that update and Undo the modification if you want.
 

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