Hi guys!...i got a problem with my search button in vb6! i have tried so many time fixing and finding whats is the problem but i still cant manage it to figure out whats the problem!....im doing a car rental system!...im searching for the plate no/firstname or lastname!....the error i alwayz get in the coding yellow line is "rs.Open query, conn" when i trying to find in the search button....anyway hears the code for the search button....hope this helpz and hope you can help me!
Private Sub Command3_Click()
Dim pr
Call connectme
conn.Open
pr = InputBox("Please Enter Any Key to Search!" & Chr(10) & Chr(13) & "PLATE NO./FIRSTNAME/LASTNAME", "Searching...")
If pr = "" Then
ElseIf pr = "All" Or pr = "all" Then
Call myquery
Else
query = "SELECT c.Rent_ID,a.firstname,a.lastname,b.Plate_No,b.Brand,c.Date_Rented,c.No_of_days FROM customertable a, cartable b, renttable c WHERE a.Cus_Id = c.Cus_Id AND b.Car_Id = c.Car_Id AND c.Status='1' AND (a.firstname LIKE '" & pr & "%' or b.lastname LIKE '" & pr & "%') AND c.Status='1'"
rs.Open query, conn
Set DataGrid1.DataSource = rs
Call datgrid
End If