CharlesWhiteman
Registered User.
- Local time
- Today, 22:24
- Joined
- Feb 26, 2007
- Messages
- 421
I'm using the following code to allow users to populate a list box. It works and performs as expressed when the txt box in blank but doesnt populate the list box when it should be. Any advice? Much appriciated.
Private Sub cmdSearchCust_Click()
Dim strSql As String
Dim strCriteria As String
strCriteria = "WHERE "
If Not IsNull(Me.txtCustName) Then
strCriteria = strCriteria & Me.txtCustName.Value
strSql = "SELECT CustID, CustName FROM TblCust" & strCriteria
Forms("FrmDoSearchOne").LbResults.RowSource = strSql
Else
MsgBox "Enter Criteria", vbExclamation, "No Criteria"
End If
End Sub
Private Sub cmdSearchCust_Click()
Dim strSql As String
Dim strCriteria As String
strCriteria = "WHERE "
If Not IsNull(Me.txtCustName) Then
strCriteria = strCriteria & Me.txtCustName.Value
strSql = "SELECT CustID, CustName FROM TblCust" & strCriteria
Forms("FrmDoSearchOne").LbResults.RowSource = strSql
Else
MsgBox "Enter Criteria", vbExclamation, "No Criteria"
End If
End Sub