S
Swagener
HI there,
I have a form which consists of txt fields and a list box, currently
the rowsource of the list box contains SQL in which the criteria points
back to the forms txtbox's with wildcards on both sides
( like "*" & form!search!surname & "*") but when I used to open the
form it took a long time to open so I decided to leave the
listbox.rowsource blank and made a button whose onclick event procedure
looks like as below but nothing happens when click the button.
But the same sql was used earlier in the rowsource of the listbox, i
tried to test the sql by removing the where clause and it works fine
and populates all the records in the list box from the table but as
soon as i add the where clause it stops working.
`````````````````start of code`````````````````
Private Sub cmdsearchcust_Click()
Dim stroesource As String
stroesource = "SELECT [SO Cust Master].cInitials, [SO Cust
Master].cSurname, [SO Cust Master].houseNumber, [SO Cust
Master].addrLine1, [SO Cust Master].postCode, [SO Cust
Master].DMBarcode FROM [SO Cust Master]
WHERE
((([SO Cust Master].cInitials) Like " * " &
[Forms]![FRMCUSTDetailSearch]![Txtsearchinitials] & " * ")
AND
(([SO Cust Master].cSurname) Like " * " &
[Forms]![FRMCUSTDetailSearch]![TXTSearch] & " * ") ;"
Forms!frmcustdetailsearch!List3.RowSource = stroesource
End Sub
````````````````````````````end of code``````````````````````
any help will be much apprieciated.
thanks in advance !
I have a form which consists of txt fields and a list box, currently
the rowsource of the list box contains SQL in which the criteria points
back to the forms txtbox's with wildcards on both sides
( like "*" & form!search!surname & "*") but when I used to open the
form it took a long time to open so I decided to leave the
listbox.rowsource blank and made a button whose onclick event procedure
looks like as below but nothing happens when click the button.
But the same sql was used earlier in the rowsource of the listbox, i
tried to test the sql by removing the where clause and it works fine
and populates all the records in the list box from the table but as
soon as i add the where clause it stops working.
`````````````````start of code`````````````````
Private Sub cmdsearchcust_Click()
Dim stroesource As String
stroesource = "SELECT [SO Cust Master].cInitials, [SO Cust
Master].cSurname, [SO Cust Master].houseNumber, [SO Cust
Master].addrLine1, [SO Cust Master].postCode, [SO Cust
Master].DMBarcode FROM [SO Cust Master]
WHERE
((([SO Cust Master].cInitials) Like " * " &
[Forms]![FRMCUSTDetailSearch]![Txtsearchinitials] & " * ")
AND
(([SO Cust Master].cSurname) Like " * " &
[Forms]![FRMCUSTDetailSearch]![TXTSearch] & " * ") ;"
Forms!frmcustdetailsearch!List3.RowSource = stroesource
End Sub
````````````````````````````end of code``````````````````````
any help will be much apprieciated.
thanks in advance !