473,581 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.tx tOcupation1 FROM tblOCUPATION UNION
Select "(All)" as Bogus, Null as AllChoice From [tblOCUPATION];
==Combo box event:
If IsNull(Me![cboFilter]) Then
DoCmd.ShowAllRe cords
Else
DoCmd.ApplyFilt er , "[Ocupation1] = '" & Me!cboFilter & "'"
End If
Forms!frmAddres s!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.Ocupa tion1 FROM
qrySearchWHERE qrySearch.Ocupa tion Like Forms!frmAddres s.cboFilter ORDER BY
qrySearch.Name;
==List box event:
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Cl one
rs.FindFirst "[RedniBroj] = " & Str(Nz(Me![LstBoxPretraziv anje], 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 8073
==List box query:
SELECT qrySearch.id, qrySearch.Name, qrySearch.Ocupa tion1 FROM
qrySearchWHERE qrySearch.Ocupa tion Like Forms!frmAddres s!cboFilter &
"*" ORDER BY
qrySearch.Name;

The query is matching only the value entered into
Forms!frmAddres s!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.tx tOcupation1 FROM tblOCUPATION UNION
Select "(All)" as Bogus, Null as AllChoice From [tblOCUPATION];
==Combo box event:
If IsNull(Me![cboFilter]) Then
DoCmd.ShowAllRe cords
Else
DoCmd.ApplyFilt er , "[Ocupation1] = '" & Me!cboFilter & "'"
End If
Forms!frmAddres s!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.Ocupa tion1 FROM
qrySearchWHERE qrySearch.Ocupa tion Like Forms!frmAddres s.cboFilter ORDER BY
qrySearch.Name;
==List box event:
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Cl one
rs.FindFirst "[RedniBroj] = " & Str(Nz(Me![LstBoxPretraziv anje], 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*******@hotm ail.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
==List box query:
SELECT qrySearch.id, qrySearch.Name, qrySearch.Ocupa tion1 FROM
qrySearchWHERE qrySearch.Ocupa tion Like Forms!frmAddres s!cboFilter &
"*" ORDER BY
qrySearch.Name;

The query is matching only the value entered into
Forms!frmAddres s!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
2988
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. (i.e. I have some tree names and depending on what tree I pick on the other combo box I can pick its fruits and other properties) Now, mine is a...
2
3634
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 that list that can be driven by a radio button. The question is, how do I go about this? I can get a radio button to execute code and the screen to...
0
2293
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. Sorts by that column when you click the button. Automatically toggles between ASC and DESC sort sequence. To implement it on a new form, you...
8
2420
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 PersonData Table that I have filled out and look at each MemberAlias column for each Person on the Table. It will then retrieve any persons with that...
1
3619
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 they could have up to three destinations. Then the user has to select a row in the list box , double click even in my listbox i have to sql query to...
3
2653
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 contents in a report which has the same fields as the form. All fields derived from report query are OK A listbox with design mode rowsource setting,...
2
2349
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 - "Region" and "Country". "Region" supports extended multiple select. I want the Country listbox to populate with all countries in all of the selected...
3
8097
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 assignments contains projectID and associateID and is related to the projects.projectID primary key and the associates.associateID primary key. I have...
2
2919
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 replace((mc.MAINTENT.id + space(20-len(mc.maintent.id))+ left(mc.MAINTENT.aenm,50) + space(50-len(left(mc.maintent.aenm,50)))+mc.mtntype.id),' ','&nbsp') as...
2
1645
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 which is datasource for query is there some other option.
0
7792
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8149
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8304
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7899
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8175
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6553
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3805
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3827
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1403
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.