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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form updatable to a single record 2

Status
Not open for further replies.

LittleNick

Technical User
Jun 26, 2009
55
US
Hi All,
I have a form (Main form) where I select an user and click a button "Info Form", it would open a second form where I can entered information for that selected user. Now my problem is, on the info form, I can entered all the data, but then if I roll the wheel on the mouse, then the info disappears and if I re-enter the data, it would then create another record. I have try to make it in a way it can not roll to another record but then it make the form not updatable. Is there a way to make the form so that rolling the wheel on the mouse won't create a new record(s) but at the same time the form can be filled and updated with information on that single record?
Thanks for helps
 
In the Other tab of the form's properties, set the Cycle to Current Record.
 
Thanks for your reply Axworthy.
It was already set to Current Record. It did not seems to stop it to change records when the wheel is roll.
 
Under the Data tab of the form's properties, set the All Additions to No. I assume that the Info Form opens and sets a filter to the selected user.
 
If you're running Access 2007, you already have a function that addresses this issue! Just check with Help.

For all other versions, you'll need some outside help. A gentleman by the name of Stephen Lebans has a sample database that does this and it can be downloaded at:


First, download and unzip the db and take a look. Go into your db and goto File > External Data > Import and import the module modMouseHook from the sample database. Next make sure you have the included file, MouseHook.dll, in the same folder your database resides in. The following code needs to run before the mousewheel will be locked:

Code:
Private Sub Form_Load()
 'Turn off Mouse Scroll
 blRet = MouseWheelOFF
End Sub
If you have one form that always loads first in your db, place the code there. If the first form to load varies, place the same code in each form.

You should be set now.


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Thanks Axworthy and missinglinq for your replies. Sorry, I was out and just got back.
I set the All Addition to No and it works great! Thanks Axworhty.
I have not tried missinglinq solution yet. Will do later tonight. Appreciate your reply missinglinq.
Again thanks for your helps
 

Setting the Cycle Property to Current Record will keep Access from moving to another record when you tab out of the final control in the Tab Order, but will not help with the mousewheel.

Setting AllowAditions to No will work, but be aware that you must now set the property to Yes before adding any records, then reset it to No after the new record(s) have been added.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
You are absolutely right missinglinq. Everytime I have to set to Yes to add a new record. I also tried your solution and worked the way I wanted.
THANKS! missinglinq.
 
Glad we could help!

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Can I lock the mousewheel for a main form but then keep the subform with the Mousewheel unlocked? Is this possible?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top