'Me.AllowAdditions = True' doesnt work

W

Widemonk

So that my mouse wheel does not keep adding blank record after blank record,
i have set the following:-

Allow Edits = Yes
Allow Deletions = Yes
Allow Additions = No

Then created a command button button:-

Private Sub cmdAdd_Click()
Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
Me.AllowAdditions = False
End Sub

In another form on the same database, it works OK however on this one, it
doesn't add a new record. The screen flickers slightly as if its trying but
then goes back to what WAS the last record, without adding a new one.

If I remove the 'Me.AllowAdditions = False' code but then add this:-

Private Sub Form_Current()
Me.AllowAdditions = False
End Sub

I get run-time error 2105 'Cant go to the specific record'

Anyone know whats going on ??

Thanks
 
K

Ken Snell [MVP]

Rather than try to use all types of code to stop the addition of new
records, go to www.lebans.com and get his free "mousewheelonoff" utility.
Use that to disable the scroll wheel. Much easier!
 
W

Widemonk

A shame because I like having the mouse as scroll, but even so, it still
stops you accidentally adding records, even with the clickable button.
 
K

Ken Snell [MVP]

Stephen's solution still allows use of scroll wheel in listboxes, combo
boxes, etc. Just doesn't let the form scroll through the records.

Are you saying that you still want to prefer your original problem? If yes,
post back here and let me know, and then I'll dig into it.
--

Ken Snell
<MS ACCESS MVP>
 

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