No value given for ine or more given requirements
-
heres the statement
Private Sub CmdSQL_Click() Dim strSearchLName, strSearchFName As String strSearchLName = txtSearchLName.Text strSearchFName = txtSearchFName.Text adoRecords.RecordSource = "Select * FROM Users Where (Last_Name) = '" & strSearchLName & "' AND (FName) = '" & strSearchFName & "' "
the varibles are getting the correct information. if i search with 1 varible, there isn't a problem. Any ideas??? here are the order of steps: user enters their first name & Last Name into text boxes. they click a button a screen pops up, showing their contact info. then the log in form shows and they need to click th log in button right now, all the contacts in the contacts table are showing but if i search with only the last name, it only shows the correct contact in the form. -
heres the statement
Private Sub CmdSQL_Click() Dim strSearchLName, strSearchFName As String strSearchLName = txtSearchLName.Text strSearchFName = txtSearchFName.Text adoRecords.RecordSource = "Select * FROM Users Where (Last_Name) = '" & strSearchLName & "' AND (FName) = '" & strSearchFName & "' "
the varibles are getting the correct information. if i search with 1 varible, there isn't a problem. Any ideas??? here are the order of steps: user enters their first name & Last Name into text boxes. they click a button a screen pops up, showing their contact info. then the log in form shows and they need to click th log in button right now, all the contacts in the contacts table are showing but if i search with only the last name, it only shows the correct contact in the form.If you only put last name, the SQL statement will be like
SELECT * FROM Users WHERE Last_Name = 'LName' AND FName = ''
Most likely it won't return you anything as there won't be a person with FName = '' The easiest way is to useAND FName LIKE'" & strSearchFName & "%'"
The recommended way is to make sure your SQL is correct (build a dynamic SQL, e.g. remove FName from condition if FName is not supplied) Hope it helps, Edbert P. Sydney, Australia.