أهلا بك أخي الكريم , لايمكنك وضع علامة التنصيص المفرد في جملة الإستعلام حول قيمة حقل ونوعه "رقم" لابد أن يكون نوعه "نص" , هذا تعديل كود حدث الـ Combo1_Click :
PHP كود :
Private Sub Combo1_Click()
If Trim$(Text5.Text) = "" Or Trim$(Combo1.Text) = "" Then Exit Sub
Dim zOption1 As String Dim zOption2 As String
If InStr(1, Combo1.Text, "&") <= 0 Then
Adodc1.RecordSource = "select * FROM seat where bus_no=" & Val(Trim$(Text5.Text)) & " And duty='" & Trim$(Combo1.Text) & "'"
Adodc1.RecordSource = "select * FROM seat where bus_no=" & Val(Trim$(Text5.Text)) & " And (duty='" & Trim$(zOption1) & "' or duty='" & Trim$(zOption2) & "')"
End If
Adodc1.Refresh
End Sub
وهذا تعديل بسيط في حدث الـ Text5_Change :
PHP كود :
Private Sub Text5_Change()
If Trim$(Text5.Text) = "" Then Adodc1.RecordSource = "select * FROM seat" Else Adodc1.RecordSource = "select * FROM seat where bus_no=" & Val(Trim$(Text5.Text)) End If
(09-11-17, 12:13 AM)Ahmed_Mansoor كتب : وعليكم السلام ورحمة الله وبركاته
أهلا بك أخي الكريم , لايمكنك وضع علامة التنصيص المفرد في جملة الإستعلام حول قيمة حقل ونوعه "رقم" لابد أن يكون نوعه "نص" , هذا تعديل كود حدث الـ Combo1_Click :
PHP كود :
Private Sub Combo1_Click()
If Trim$(Text5.Text) = "" Or Trim$(Combo1.Text) = "" Then Exit Sub
Dim zOption1 As String Dim zOption2 As String
If InStr(1, Combo1.Text, "&") <= 0 Then
Adodc1.RecordSource = "select * FROM seat where bus_no=" & Val(Trim$(Text5.Text)) & " And duty='" & Trim$(Combo1.Text) & "'"
Else zOption1 = Left$(Combo1.Text, InStr(1, Combo1.Text, "&") - 1) zOption2 = Mid$(Combo1.Text, InStr(1, Combo1.Text, "&") + 1) Adodc1.RecordSource = "select * FROM seat where bus_no=" & Val(Trim$(Text5.Text)) & " And (duty='" & Trim$(zOption1) & "' or duty='" & Trim$(zOption2) & "')" End If
Adodc1.Refresh
End Sub
وهذا تعديل بسيط في حدث الـ Text5_Change :
PHP كود :
Private Sub Text5_Change()
If Trim$(Text5.Text) = "" Then Adodc1.RecordSource = "select * FROM seat" Else Adodc1.RecordSource = "select * FROM seat where bus_no=" & Val(Trim$(Text5.Text)) End If
Adodc1.Refresh
End Sub
بارك الله بك استاذ احمد
فعلاً انه يعمل الان بشكل جيد
جعلها الله في ميزان حسناتك