468,315 Members | 1,459 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

Listbox query -show all records

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
2 7697
==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

"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.

Similar topics

2 posts views Thread by Colleyville Alan | last post: by
reply views Thread by Ray | last post: by
8 posts views Thread by daddydfsu via AccessMonster.com | last post: by
1 post views Thread by rsbutterfly16 via AccessMonster.com | last post: by
3 posts views Thread by Prochot | last post: by
2 posts views Thread by dachrist28 | last post: by
2 posts views Thread by Mirnes | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.