M
Matt P
Hello I am sure I was trying to go about this the wrong way and it
almost worked out I have a form with an Option Group which has 8
fields. So I put a "Select Case" statement in vb. And now for my
problem, I have 2 list boxes that I want to get populated off of the
selection they make and only show the results pertaining to that
selection, basically a filter. I got this to work by adding an
unbound text box to my form "txtSortBy" which then in each case I made
it change the value to the selection that they made. With this I got
almost all of them working, only 3 selections didn't work properly.
Here's my sql:
SELECT tblContacts.fldAddress, tblContacts.fldContactsID
FROM tblContacts INNER JOIN tblHistory ON tblContacts.fldContactsID =
tblHistory.fldContactID
WHERE (((tblContacts.fldCity)=[cmbSearchComp]) AND
((tblHistory.fldType)=[txtSortBy]))
GROUP BY tblContacts.fldAddress, tblContacts.fldContactsID, Mid$
(tblContacts.fldAddress,InStr(tblContacts.fldAddress," ")+1)
ORDER BY Mid$(tblContacts.fldAddress,InStr(tblContacts.fldAddress," ")
+1);
The ones that didn't work are (these are from the select case
statement):
Me.txtSortBy.Value = "Is Null"
Me.txtSortBy.Value = "APARTMENT OR CONDO"
Me.txtSortBy.Value = "HOTEL OR MOTEL"
The other 5 work, just these 3. I would have skipped this whole
unbound text field if I could have figured out what the proper syntax
was to add this query into vba and still function. Thanks for any
input!
almost worked out I have a form with an Option Group which has 8
fields. So I put a "Select Case" statement in vb. And now for my
problem, I have 2 list boxes that I want to get populated off of the
selection they make and only show the results pertaining to that
selection, basically a filter. I got this to work by adding an
unbound text box to my form "txtSortBy" which then in each case I made
it change the value to the selection that they made. With this I got
almost all of them working, only 3 selections didn't work properly.
Here's my sql:
SELECT tblContacts.fldAddress, tblContacts.fldContactsID
FROM tblContacts INNER JOIN tblHistory ON tblContacts.fldContactsID =
tblHistory.fldContactID
WHERE (((tblContacts.fldCity)=[cmbSearchComp]) AND
((tblHistory.fldType)=[txtSortBy]))
GROUP BY tblContacts.fldAddress, tblContacts.fldContactsID, Mid$
(tblContacts.fldAddress,InStr(tblContacts.fldAddress," ")+1)
ORDER BY Mid$(tblContacts.fldAddress,InStr(tblContacts.fldAddress," ")
+1);
The ones that didn't work are (these are from the select case
statement):
Me.txtSortBy.Value = "Is Null"
Me.txtSortBy.Value = "APARTMENT OR CONDO"
Me.txtSortBy.Value = "HOTEL OR MOTEL"
The other 5 work, just these 3. I would have skipped this whole
unbound text field if I could have figured out what the proper syntax
was to add this query into vba and still function. Thanks for any
input!