📄 send_request.frm
字号:
Height = 375
Left = 3800
Top = 920
Width = 1310
End
Begin VB.Label Label14
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "Number"
ForeColor = &H80000008&
Height = 285
Left = 3840
TabIndex = 29
Top = 960
Width = 615
End
Begin VB.Label Label5
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "Buy ticket in sector"
ForeColor = &H80000008&
Height = 315
Left = 120
TabIndex = 6
Top = 1320
Width = 1455
End
Begin VB.Label Label3
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "Tickets left for this game"
ForeColor = &H80000008&
Height = 285
Left = 1440
TabIndex = 5
Top = 960
Width = 1935
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "There are :"
ForeColor = &H80000008&
Height = 285
Left = 120
TabIndex = 4
Top = 960
Width = 855
End
Begin VB.Label Label4
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "vs"
Height = 255
Left = 2040
TabIndex = 3
Top = 480
Width = 495
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "You choose the match :"
ForeColor = &H80000008&
Height = 285
Left = 120
TabIndex = 2
Top = 120
Width = 1935
End
End
Attribute VB_Name = "send_request"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lea, leb, lec, led As Integer
Private Sub buy_Click()
Dim counta, caraa
counta = 0
' With Data1.Recordset
' .Edit
' !nombre = !nombre - number.text
' .Update
' End With
If DBCombo1.text = "Sel" Then
MsgBox "please specify the sector", 48, "missing"
Exit Sub
End If
If Text3.text <= 0 Then
MsgBox "Sorry, but all the tickets has been sold!", 48, "Error"
ElseIf IsNumeric(number) = False Then
MsgBox "enter a number !!!", 48, "error!"
ElseIf number = 0 Then
MsgBox "You have to buy at least 1 ticket", 48, "error"
ElseIf number.text > Text3.text Then
MsgBox "there not enough tickets left...", 48, "error"
Exit Sub
ElseIf Text4 = "" Then
MsgBox "enter name", 48, "error"
ElseIf Text5 = "" Then
MsgBox "enter surname", 48, "error"
ElseIf Text6 = "" Then
MsgBox "enter address", 48, "error"
ElseIf Text7 = "" Then
MsgBox "enter NPA", 48, "error"
ElseIf IsNumeric(Text7) = False Then
MsgBox "Please enter correct type!", 48, "NPA"
Exit Sub
ElseIf IsNumeric(Text7) = True Then
For caraa = 1 To Len(Text7)
counta = counta + 1
Next caraa
If counta <> 4 Then
MsgBox "wrong number", 48, "NPA"
Exit Sub
Else
If Text8 = "" Then
MsgBox "enter locality", 48, "error"
ElseIf Option1 = True Then
Call verify
ElseIf Option2 = True Then
Call tempo
End If
End If
End If
End Sub
Private Sub buy_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
buy.FontBold = True
CANCEL.FontBold = False
print_.FontBold = False
End Sub
Private Sub CANCEL_Click()
DBCombo1.text = "Sel"
Text3.text = ""
Unload Me
'Mainform.Show
End Sub
Private Sub CANCEL_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
CANCEL.FontBold = True
buy.FontBold = False
End Sub
Private Sub DBCombo1_Change()
number_Change
End Sub
Private Sub Form_Activate()
DBCombo1.text = "Sel"
Text3.text = ""
number.text = "0"
Price.text = "0"
With Data2.Recordset
.MoveFirst
lea = !nombre
.MoveNext
leb = !nombre
.MoveNext
lec = !nombre
.MoveNext
led = !nombre
Exit Sub
End With
End Sub
Private Sub Form_Load()
Text1.text = Buy_ticket.Text11.text
Text2.text = Buy_ticket.Text12.text
DBCombo1.AddItem ("A")
DBCombo1.AddItem ("B")
DBCombo1.AddItem ("C")
DBCombo1.AddItem ("D")
'On Error GoTo erhand
'erhand:
' Exit Sub
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
buy.FontBold = False
CANCEL.FontBold = False
print_.FontBold = False
If DBCombo1.text = "Sel" Then
Text3.text = "0"
ElseIf DBCombo1.text = "A" Then
Text3 = lea
number_Change
ElseIf DBCombo1.text = "B" Then
Text3 = leb
number_Change
ElseIf DBCombo1.text = "C" Then
Text3.text = lec
number_Change
ElseIf DBCombo1.text = "D" Then
Text3.text = led
number_Change
End If
End Sub
Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
number_Change
End Sub
Private Sub number_Change()
If IsNumeric(number) = False Then
MsgBox "enter a number please!", 48, "error in format"
number.text = ""
Exit Sub
End If
number = CInt(number)
On Error GoTo fin:
Select Case DBCombo1.text
Case "A"
Price.text = number * 2.51
Case "B"
Price.text = number * 3.24
Case "C"
Price.text = number * 6
Case "D"
Price.text = number * 8.5
End Select
fin:
End Sub
Private Sub print__Click()
Dim response
On Error GoTo errorhandler:
response = MsgBox("Form will automaticly print when clicking on BUY" & Chr(13) & _
"Print?", vbYesNo, "print?")
If response = vbYes Then
send_request.PrintForm
MsgBox "request printed", 48, "PRINT"
Exit Sub
Else
Exit Sub
End If
errorhandler:
response = MsgBox("there was an error with your printer!", vbRetryCancel, "printer error")
If response = vbRetry Then
MsgBox "printer error!", 48, "printer error"
Exit Sub
Else
Exit Sub
End If
End Sub
Function envoi()
Dim objSession As Object
Dim objMessage As Object
Dim objRecipient As Object
On Error GoTo er:
Set objSession = CreateObject("mapi.session")
objSession.Logon profileName:="Default"
Set objMessage = objSession.Outbox.Messages.add
objMessage.Subject = "tennis new request"
objMessage.text = Text4.text & Chr(13) & Text5.text & _
Chr(13) & Text6.text & Chr(13) & Text7.text & Chr(13) & Text8.text & Chr(13) & Chr(13) & number.text & " places in sector " & DBCombo1.text & Chr(13) & "The price for the command is " & Price.text & "USD"
Set objRecipient = objMessage.Recipients.add
objRecipient.Name = "maxime.gheysen@swisscom.com"
objRecipient.Type = mapiTo
objRecipient.Resolve
objMessage.Send showDialog:=False
MsgBox "Message sent successfully!"
objSession.Logoff
send_request.PrintForm
With Data2.Recordset
.Edit
!nombre = !nombre - number
.Update
.Close
End With
Unload Me
frmSplash.Show
GoTo en
er:
MsgBox "error with your printer", 48, "ERROR!"
Exit Function
en:
End Function
Private Sub print__MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
print_.FontBold = True
buy.FontBold = False
End Sub
Function verify()
Dim count, cara, carab, countb, carac, countc, carad
count = 0
countb = 0
countc = 0
If IsNumeric(Text10) = False Then
MsgBox "wrong number", 48, "visa"
Exit Function
Else
For cara = 1 To Len(Text10)
count = count + 1
Next cara
If count <> 6 Then
MsgBox "wrong number", 48, "visa"
Exit Function
End If
End If
If IsNumeric(Text9) = False Then
MsgBox "insert correct expire date!", 48, "visa"
Exit Function
Else
For carab = 1 To Len(Text9)
countb = countb + 1
Next carab
If countb < 2 Then
MsgBox "wrong expire date", 48, "visa"
Exit Function
End If
End If
If Text9 > 12 Then
MsgBox "months go to 12...", 48, "error"
Exit Function
End If
If IsNumeric(Text11) = False Then
MsgBox "insert correct expire date!", 48, "visa"
Exit Function
Else
For carac = 1 To Len(Text11)
countc = countc + 1
Next carac
If countc < 4 Then
MsgBox "insert correct expire date!", 48, "visa"
Exit Function
End If
End If
If Text11 < 2001 Then
MsgBox "year in the past...", 48, "error!"
Exit Function
End If
MsgBox "payment accepted", 48, "method"
Call tempo
End Function
Function tempo()
Dim larep
larep = MsgBox("Are all these informations correct ?" & Chr(13) & Chr(13) & Text4.text & Chr(13) & Text5.text & _
Chr(13) & Text6.text & Chr(13) & Text7.text & Chr(13) & Text8.text & Chr(13) & Chr(13) & number.text & " places in sector " & DBCombo1.text & Chr(13) & "The price for your command is " & Price.text & "USD" & Chr(13), vbYesNo, "CONFIRM")
If larep = vbYes Then
Call envoi
Else
Exit Function
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -