473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 8040
==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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Giulio | last post by:
Hello, I have a continuous form with a combo box inside. From the combo box I can pick some values which, by the "after-update" event, change some other combo box values determined by a query....
2
by: Colleyville Alan | last post by:
I have a listbox that is populated with info and when the user selects categories of things from the list, it brings up detailed items from which to choose. I want to be able to put a filter on...
0
by: Ray | last post by:
Folks, I have just created a simple procedure that does the following: Determines the width of the columns of a listbox. Places a button of the correct size above each column as the form opens....
8
by: daddydfsu via AccessMonster.com | last post by:
I am trying to create a ListBox based on a search from a TextBox. I have a TextBox where I will enter in a MemberAlias. I want to click on a Search Button and that will do a select from a...
1
by: rsbutterfly16 via AccessMonster.com | last post by:
hi guys i have form with a listbox . The listbox is coming from a query that gets all passengers(column 1 in listbox) and destinations(column 3) . so you have repeting rows of passengers since...
3
by: ML | last post by:
I have used Allen Brown's technique for filling a listbox on a form with the names of files in a certain disc folder. It works well. I am now giving the user the option to print the form...
2
by: Chucara | last post by:
Hi, I'm trying to build a simple search in Access. I'll just give a simplified example, as I think I can solve the problem, if you can help me with this subproblem.. I have 2 listboxes -...
3
by: Prochot | last post by:
I'm trying to design a database to track projects and the associates assigned to them. I have almost no experience with this. I have three tables: -Projects -Associates -Assignments where...
2
by: dachrist28 | last post by:
I am trying to populate a listbox with data that is pulled from a sql query. Here is my C# code behind the page: sqlConn1.Open(); SqlCommand sqlComm2 = new SqlCommand("SElECT...
2
by: Mirnes | last post by:
I have a listbox which is populated from Sql query and I use it to add values to table. I would like to exclude value which just has been added from listbox. Since it is impossible to do in query...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.