"After debugging is basically the appear a mistake, no any records shown in the window, how to return a responsibility? Examples of the book
CodePudding user response:
You did not enter in Text2 wildcard *,CodePudding user response:
What do you mean? This is the whole process of programPrivate Sub Command3_Click () 'by flight number query
If Text2 & gt; "" Then
Form2. Adodc1. RecordSource="Select * from airplane where no like '" & amp; Text2. Text & amp; "'
"'Form2. Adodc1. RecordSource="Select * from airplane where no like'" & amp; Text2 & amp; "'
"The Else
Form2. Adodc1. RecordSource="Select * from airplane"
End the If
Form2. Adodc1. Refresh
End Sub
CodePudding user response:
Code according to your logic, determine the user's operation rules:If you want to find FM the beginning of the flight number, Text2 to enter FM *
If you want to find 34 at the end of the flight number, Text2 to enter * 34
Light input FM or 34 is not matching,
CodePudding user response:
That should I can directly input FM34? But I input the database set the flight number, but does not display the records in the DataGridCodePudding user response:
Form2. Adodc1. RecordSource="Select * from airplane where no like '*' & amp; Text2 & amp; '*' "
CodePudding user response:
Not LikeCodePudding user response:
In addition, Not Like the front will have a field name,CodePudding user response:
# 6: no is his list of field names!CodePudding user response:
Try:Form2. Adodc1. RecordSource="Select * from airplane where [no] like a '*' & amp; Text2 & amp; '*'"
CodePudding user response:
# 7. The teacher or not, or I'll send you the program you help me to look at what the problem is, I do is according to the example of the book, feeling a lot of the wrong places, this example fully understand, I can use their own system, thank you!CodePudding user response:
# 8. Teacher, you can help me to look at the program, do as you say methods are tried, still won't do, other viewing can be shown correctly, as this not line, thank you!CodePudding user response:
# 7. Text box input conditions for the If don't show record, when the conditions for the Else, namely a text box, what characters are not input, all records are displayed, don't know how to return a responsibilityCodePudding user response:
'I open Access with its special design generates a SQL query, you directly fixed character first query try'
Form2. Adodc1. RecordSource="Select * from airplane where (((airplane. No) Like '* * FM))"
'then to use the input number of'
Form2. Adodc1. RecordSource="Select * from airplane where (((airplane. No) Like a '*' & amp; Text2 & amp; '*')) "
CodePudding user response:
# 13. Ok, thank you, I try againCodePudding user response:
# 13. The teacher or not, according to the fixed character, shows all the flight information, enter the serial number or don't show any flight , the book example, a lot of wrongCodePudding user response:
Debug. Print "Select * from airplane where (((airplane. No) Like a '*' & amp; Text2 & amp; '*')) "
Add a debug output to see what is the string content, and what is the difference between fixed character
CodePudding user response:
Did your Form2. Adodc1 in Form2 panel?CodePudding user response:
# 17. This must be in form2 Adodc1 this control, the other query methods to display in normal flight information, just not this according to the flight numberCodePudding user response:
Try:The Debug. Print "Select * from airplane where (((airplane. No) Like '%" & amp; Text2 & amp; "% '))"
CodePudding user response:
Form 1 codeOption Explicit
Private Sub Command1_Click () 'by the route query
Dim Sc $, Lc $
Sc=List1. Text 'take off site
Lc=List2. Text 'arrive take place
If Sc & gt; "" And Lc & gt; "" Then 'scores query according to the circumstance
Form2. Adodc1. RecordSource="Select * from airplane where startcity='" & amp; Sc & amp; "' and landcity=" & amp; Lc & amp; "'
"ElseIf Sc & gt; "" Then
Form2. Adodc1. RecordSource="Select * from airplane where startcity='" & amp; Sc & amp; "'
"ElseIf Lc & gt; "" Then
Form2. Adodc1. RecordSource="Select * from airplane where landcity='" & amp; Lc & amp; "'
"The Else
Form2. Adodc1. RecordSource="Select * from airplane"
End the If
Form2. Adodc1. Refresh 'update
End Sub
Private Sub Command3_Click () 'by flight number query
If Text2 & gt; "" Then
The Debug. Print "Select * from airplane where (((airplane. No) Like '%" & amp; Text2 & amp; "% '))
"Form2. Adodc1. RecordSource="Select * from airplane where no like '" & amp; Text2. Text & amp; "'
"'Form2. Adodc1. RecordSource="Select * from airplane where no like'" & amp; Text2 & amp; "'
"The Else
Form2. Adodc1. RecordSource="Select * from airplane"
End the If
Form2. Adodc1. Refresh
End Sub
Private Sub Command4_Click ()
Form2. Show
End Sub
Private Sub Command5_Click ()
End
End Sub
Private Sub Form_Load ()
Dim mpath $, mlink $
Mpath=App. Path
If Right (mpath, 1) & lt;> "" Then mpath=mpath + ""
Mlink="Provider=Microsoft. ACE. The OLEDB. 12.0. The Data Source=plane. Accdb; Persist Security Info=False;"
'mlink=mlink + mpath "Data Source=" + + "plane. Accdb
"Form2. Adodc1. The ConnectionString sets the ConnectionString attribute
=mlink 'Form2.Adodc1.Com mandType set command type=adCmdUnknown '
Form2. Adodc1. RecordSource="Select Startcity from airplane group by Startcity" 'classification according to the departure city
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull