By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,272 Members | 1,399 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,272 IT Pros & Developers. It's quick & easy.

Listbox query -show all records

P: n/a
I'm creating Address book.
Header of the main form (frmAddress) contains combo box (cboFilter) to
filter records by Occupation on main Form(Ocupation1). That's working. Combo
box also have "Show All" in one row.

==Combo box query:
SELECT tblOCUPATION.id, tblOCUPATION.txtOcupation1 FROM tblOCUPATION UNION
Select "(All)" as Bogus, Null as AllChoice From [tblOCUPATION];
==Combo box event:
If IsNull(Me![cboFilter]) Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[Ocupation1] = '" & Me!cboFilter & "'"
End If
Forms!frmAddress!LstBoxSearch.Requery

That's working.

Here is the Problem.
I have text box on main form to show all records or filtered ones, and to
pick a name from it (it must be the same as records on main form!).
When i pick Ocupation in cboFilter Text box is filtered, Form filtered but
when i select Ocupation in cboFilter=Null (=Show All Records) it dosent show
enything in text box ?! (Note: records on main Form working and showing all
records)?!

==List box query:
SELECT qrySearch.id, qrySearch.Name, qrySearch.Ocupation1 FROM
qrySearchWHERE qrySearch.Ocupation Like Forms!frmAddress.cboFilter ORDER BY
qrySearch.Name;
==List box event:
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[RedniBroj] = " & Str(Nz(Me![LstBoxPretrazivanje], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

I think that problem is in List box query? maybe something like "...UNION
show all records"... but i tried many ways, search the web and that didnt
worked for me.

Thanks for help
(sorry for bad english)
Aug 28 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
==List box query:
SELECT qrySearch.id, qrySearch.Name, qrySearch.Ocupation1 FROM
qrySearchWHERE qrySearch.Ocupation Like Forms!frmAddress!cboFilter &
"*" ORDER BY
qrySearch.Name;

The query is matching only the value entered into
Forms!frmAddress!cboFilter and nothing more.
Zeljko wrote:
I'm creating Address book.
Header of the main form (frmAddress) contains combo box (cboFilter) to
filter records by Occupation on main Form(Ocupation1). That's working. Combo
box also have "Show All" in one row.

==Combo box query:
SELECT tblOCUPATION.id, tblOCUPATION.txtOcupation1 FROM tblOCUPATION UNION
Select "(All)" as Bogus, Null as AllChoice From [tblOCUPATION];
==Combo box event:
If IsNull(Me![cboFilter]) Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[Ocupation1] = '" & Me!cboFilter & "'"
End If
Forms!frmAddress!LstBoxSearch.Requery

That's working.

Here is the Problem.
I have text box on main form to show all records or filtered ones, and to
pick a name from it (it must be the same as records on main form!).
When i pick Ocupation in cboFilter Text box is filtered, Form filtered but
when i select Ocupation in cboFilter=Null (=Show All Records) it dosent show
enything in text box ?! (Note: records on main Form working and showing all
records)?!

==List box query:
SELECT qrySearch.id, qrySearch.Name, qrySearch.Ocupation1 FROM
qrySearchWHERE qrySearch.Ocupation Like Forms!frmAddress.cboFilter ORDER BY
qrySearch.Name;
==List box event:
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[RedniBroj] = " & Str(Nz(Me![LstBoxPretrazivanje], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

I think that problem is in List box query? maybe something like "...UNION
show all records"... but i tried many ways, search the web and that didnt
worked for me.

Thanks for help
(sorry for bad english)
Aug 28 '06 #2

P: n/a

"Jeff L" <jl*******@hotmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
==List box query:
SELECT qrySearch.id, qrySearch.Name, qrySearch.Ocupation1 FROM
qrySearchWHERE qrySearch.Ocupation Like Forms!frmAddress!cboFilter &
"*" ORDER BY
qrySearch.Name;

The query is matching only the value entered into
Forms!frmAddress!cboFilter and nothing more.

Fast and Perfect. Thanks
Aug 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.