Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Turn off ability to scroll between records 1

Status
Not open for further replies.

raf

Programmer
Apr 10, 2000
14
US
I have a customer order form. I want the user to enter exactly one order, then close the form. (Closing triggers VBA code to do a bunch of stuff.)

The record selector and navigation buttons are turned off, but now the user has a mouse with a scroll wheel. When he accidentally scrolled with the scroll wheel, the form starting generating new orders, giving us several order numbers for empty orders.

Questions:
Is there a way to allow EXACTLY one new record to be entered? (I have DataEntry = yes, AllowAdditions = Yes)

Is there a way to disable the scroll wheel?

Thanks -- RAF
 
One way to avoid this problem is to not bind the controls on your form to the table. You can still use look-up functionality where needed and when they click your go button (save or whatever) you can build an insert query based on the control values and there you have it.
 
One solution involves setting three Form properties.

1) First, set the Form property "Default View" from "Continuous Forms" to "Single Form". In doing so, you have modified the display environment to only allow one record to be displayed at a time;

2) Second, to prevent form navigation to other records, set the Form property "Navigation Buttons" to "No";

3) Finally, to prevent the user from reaching other records through "Tab Cycling", set the Form property "Cycle" to "Current Record".

This should provide a fairly robust solution to your problem.

Hope this helps.


 
I tried that and the mouse wheel still zooms through the records.
 
It seems nobody has an easy work-around for this. I went to MS page for their programmed solution. Since I don't know anyabout ActiveX or dll programming, I opted for their VBA code embedded in my form. I cut and pasted everything per their instructions, and it seems to work.

The problems are
(1) What a lot of work. I have to modify the load/unload VBA code in any form that has data entry to disable the mouse-wheel.
(2) They have a caveat about "Access might stop responding" ... I haven't given the code yet to my user.

Has anyone tried this and know about the side effects?

Thanks -- RAF
 
The amount of 'before_update' coding you have to do when you are really only talking about single row entry... I find it's easier just to not bind. Thanks very much for the info though. I started out with nothing, and I still have most of it.
 
Raf can u paste the code would be interested in trying it, I have justed noticed the problem and wouldlike to test it before I hand out any more software.

Zero
 
That's amazing, crazy effect and crazy code to fix it. I'd agree with jhall, unbind. Certainly one to look out for in the future Peter Meachem
peter@accuflight.com
 
Here's a simple solution ... unfortunately, I'm testing this without the benefit of a scroll-wheel.

1) In the form's "General Declaration's" section:

Dim AllowNewRecord As Boolean

2) Initialize that variable in the form's "Form_Open" event which will allow generation of the first record only:

AllowNewRecord = True

3) Check, prior to allowing a new record to be inserted in the form's "Form_BeforeInsert" event:

Select Case AllowNewRecord
Case True
Cancel = False
Case Else
Cancel = True
End If

4) After the first record is generated, deny generation of subsequent records using the form's "Form_AfterInsert" event:

AllowNewRecord = False


Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top