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

Block user from scrolling through form records. And decimal numbers

Status
Not open for further replies.

doerfohio

Technical User
Aug 30, 2004
34
US
I have removed the page scroll bar on the bottom of my form (I don't remember how I did that!), however, the user can still click in a field and use the scroller on the mouse to go through records. I need to prevent that but I don't know how.

And also, in my table and my form, I need to enter decimal numbers with 2 places to the right of the decimal. On the properties, I chose "Standard" format and "2" in the decimal option. The number looks right when I add it to the form, but as soon as I go to the next record, it rounds the number up. I key in 3.75 and it saves as 4. What am I overlooking?

TIA
 
In the table, I've got it in a fixed format with 2 places to the right of the decimal. I've got the same setting on the form field properties. Still, when I type in a decimal number, it rounds it to a whole number when it goes into the table(that is, a whole number with a decimal and two zeros to the right. I tried using "standard" and "general" format on both the form and the table with the same results.

Thanks for the links for the mouse wheel question. Wow! I guess there's no easy fix. ; )
 
There's lot of mouse scroll info here on this site (do a search on it), there's also at least one faq on the topic (browse the faq section of the Access fora)

The format of the field isn't what lupins46 hints to, but the field size. You probably have long integer or integer, but need single/double.

Roy-Vidar
 
Great! The numbers are saving correctly now. Thanks for the info! I'm very new to this so I don't quite understand the language yet.

I'll check more into the mouse scrolling too.

 
Ok. I found some instructions here I and got through the first few steps. Then it says to put this code "behind your form". How do I do that? And what are global declarations?
TIA

'Global declarations should be here before the code

'This enum is for clarifying the code below.
Private Enum wsTrigger
MyWheel = 1
NotTheWheel = 2
End Enum

Private mWheel As Boolean
Private ValidationTrigger As wsTrigger

'End of global declarations

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 Sub_Err
mWheel = True
ValidationTrigger = MyWheel
Me.UnboundTextBox.SetFocus
Me.UnboundTextBox.TEXT = " "
Sub_Exit:
ValidationTrigger = NotTheWheel
Exit Sub
Sub_Err:
Resume Sub_Exit
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top