troubleshooting Question

MS Access 2007 "Select Case" method

Avatar of SirTKC
SirTKC asked on
Microsoft Access
13 Comments1 Solution2923 ViewsLast Modified:
HI Experts !

I don't know why, but I am trying to use a very simple method here called "select case" and for a reason I ignore, it simply doesnt want to return any value.
I am changing the value with a list box and based on the selection, I want the execute a calculation and insert the result in a field on the same form.

In order to facilitate the viewing, here is the code
Private Sub Combo19_Change()
On Error GoTo PoidsErr
 
Dim BoxStyle As String
Dim x, y, z, a, b As Integer
 
x = Me.D_Long
y = Me.D_Larg
z = Me.D_Haut
 
BoxStyle = Me.M_Name
 
Select Case BoxStyle
 
Case "régulière"
a = (x / 2) * z
b = (z / 2) * x
 
Me.EmbPoids = (((x * y * 2) + (z * y * 2) + (a * 4) + (b * 4)) / 144) * 10
 
Case "Semi-régulière"
a = (x / 2) * z
b = (z / 2) * x
 
Me.EmbPoids = (((x * y * 2) + (z * y * 2) + (a * 2) + (b * 2)) / 144) * 10
 
Case "Filler"
 
Me.EmbPoids = (((x * y * 2) + (z * y * 2)) / 144) * 10
 
PoidsErr:
    MsgBox "Error " & Err.Number & " - " & Err.Description
    Resume PoidsErr
 
End Select
Me.Recalc
End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros