Advertisement
Advertisement
| 06.11.2008 at 01:51PM PDT, ID: 23477421 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: |
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim Strsql, State, Message As String, vLimit, i, counter As Integer, rs As ADODB.Recordset
If IsNull(Owneship.Value) Or Owneship.Value > 1 Then
MsgBox "Ownership column Can not be Blank or have a value greater than 1.0 ", vbOKOnly, "Missing Info"
Reported.Value = 0
Owneship.Value = Null
Exit Sub
End If
Strsql = "Select state, owneship from vOwneshipCheckByST where state = '" & State.Value & "' "
Set rs = CurrentProject.Connection.Execute(Strsql)
vLimit = 1
If rs("Owneship") + Owneship.Value > 1 Then
If MsgBox("The Combined Ownership of all dealers in this state has exceeded 100%" & vbCrLf & _
"Would you like to see a list of all dealers in this state and their marketshare percentages?", vbYesNo, "MarketShare Exceeded!") = vbYes Then
State = State.Value
Strsql = ""
Set rs = Nothing
'Strsql = "Select count (*) as count from vOwneshiopCheck where state = '" & state & "'"""
Strsql = "Select * from vOwnershipCheck where state = '" & State & "'"
Set rs = CurrentProject.Connection.Execute(Strsql)
Message = ""
While Not rs.EOF
Message = Message + Trim(rs("ReportingName")) & " has marketshare of " & rs("Owneship") & "." & vbCrLf
rs.MoveNext
Wend
MsgBox Message, vbInformation, "Market Share distribution for: " & State
End If
Reported.Value = 0
Owneship.Value = Null
End If
End Sub
|