It has been more than a week since the data center Charging System was launched. Now, it is said that the system is relatively difficult-a combination of queries. In fact, before entering this door, I have already built an insurmountable wall for myself. I heard it was hard, so I knew it was hard to move back and never wanted to touch this part. But I couldn't always stay, So I forced myself to move forward, after several tomato times, the information is displayed, and I don't know if it is correct. I hope you will criticize and correct it.
First: Controls each row as a whole. I divide the form into three parts.
ItsCodeAs follows:
If testtxt (combo1.text) and testtxt (combo2.text) and testtxt (text1.text) then', each row in the form is regarded as a whole and the overall control dd (0) = true end if testtxt (combo4.text) and testtxt (combo5.text) and testtxt (text2.text) Then dd (1) = true end if testtxt (combo7.text) and testtxt (combo8.text) then dd (2) = true end if
Second: Write the implementation statement based on each row. The Code is as follows:
If dd (0) = true and DD (1) = false and DD (2) = false then strtxtsql = strtxtsql & filename (combo1.text) & trim (combo2.text) & "'" & trim (text1.text )&"'"
Select case combo3.text case "and" strtxtsql = strtxtsql & "and" & filename (combo1.text) & trim (combo2.text) & "'" & trim (text1.text) & "'" case "or" strtxtsql = strtxtsql & "or" & filename (combo1.text) & trim (combo2.text) & "'" & trim (text1.text) & "'" End select else if dd (0) = true and DD (1) = true and DD (2) = false then strtxtsql = strtxtsql & filename (combo4.text) & trim (combo5.text) & "'" & trim (text2.text )&"'" Select case combo6.text case "and" strtxtsql = strtxtsql & "and" & filename (combo4.text) & trim (combo5.text) & "'" & trim (text2.text) & "'" case "or" strtxtsql = strtxtsql & "or" & filename (combo4.text) & trim (combo5.text) & "'" & trim (text2.text) & "'" End select else if dd (0) = true and DD (1) = true and DD (2) = true then strtxtsql = strtxtsql & filename (combo7.text) & trim (combo8.text) & "'" & trim (text2.text) & "'" end if set MRC = executesql (strtxtsql, strmsgtext)
Last: Display the information in the query record set to the myflexgrid control. The Code is as follows:
With myflexgrid displays the information in the queried record set through the myflexgrid control. rows = 2. cellalignment = 4. textmatrix (1, 0) = "card number ". textmatrix (1, 1) = "name ". textmatrix (1, 2) = "computer date ". textmatrix (1, 3) = "Machine Time ". textmatrix (1, 4) = "IDC No." Do While (not MRC. EOF ). rows =. rows + 1. cellalignment = 4. textmatrix (. rows-1, 0) = MRC. fields (0 ). textmatrix (. rows-1, 1) = MRC. fields (1 ). textmatrix (. rows-1, 2) = MRC. fields (2 ). textmatrix (. rows-1, 3) = MRC. fields (3 ). textmatrix (. rows-1, 4) = MRC. fields (4) MRC. movenext loop end
This solution may not be satisfactory, but it is always better, write it down and encourage yourself.