Hai, i'm new here, i would like to ask about SQL statements, i'm using VB6.0 and my systems if more on searching record, so the SQL statements is very important to search a record, so back to the question, i do this to search the "company name"
And here the method of fillfields()
I got the msg "No Record Match" when i try the LIKE statements in the Microsoft Office access same as my code above, it return correct output. then i thought it is because of the logic error in fillfields method, then i try change the LIKE statements to
it return a correct output. For your information sName field cannot be the same and i already create a code to validate it. Can anyone can help me to trace the logic error on it?
thanks in advance
Code:
Private Sub cmdNameView_Click() Dim strSQL As String inputName = UCase(txtName.Text) Set rs = New ADODB.Recordset If inputName <> "" Then strSQL = "SELECT * FROM SUPPLIER WHERE sName LIKE '*" & inputName & "*'" MsgBox strSQL rs.Open strSQL, conn, adOpenKeyset, adLockPessimistic, adCmdText fillfields End If End Sub
Code:
Public Sub fillfields() NotEditable frameSDetail.Visible = True If Not (rs.BOF = True Or rs.EOF = True) Then txtsName.Text = rs.Fields("sName") txtsAddress.Text = rs!sAddress txtPost_Code.Text = rs!Post_Code txtCity.Text = rs!City txtPhone.Text = rs!Phone txtEmail.Text = rs!Email txtFax.Text = rs!Fax txtService.Text = rs!Service Else MsgBox "No Record Match", vbExclamation, "Cannot Move" End If Exit Sub End Sub
Code:
SELECT * FROM SUPPLIER WHERE sName = '" & inputName & "'
thanks in advance
Comment