Private Sub Insert_Database(Byval x As String)
Dim tmp as String
Select Case x
Case Is >= 40 Then
tmp = "A"
Case Is >= 20
tmp = "B"
Case Is >= 2
tmp = "C"
Case Else
Exit Sub
End Select
cn.Execute "INSERT INTO yourtable(yourfield) VALUES('" & tmp & "')"
Private Sub Command2_Click()
Dim x As String
x = 30
If x > 40 Then
MsgBox "insert into a"
ElseIf 20 <= x <= 40 Then
MsgBox "insert into b"
Else
MsgBox "insert into c"
End If
End Sub