 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 4th, 2006, 03:24 AM
|
|
Authorized User
|
|
Join Date: Apr 2006
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
|
|
LIST BOXES
Hi,again
I have a problem with 2 list boxes in the same form!
There is a first list box which shows me an ID number.
There is also an a second list box which shows me in every line, the ID number as above and 3 fields more.
I'm trying when I'm selecting the ID from the first list box to show me in the second list box, only lines with the same ID number.
I'd be grateful if you could answrer me!
Vision G
|
|

May 4th, 2006, 03:29 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Vis,
I got that ur tyr something to do but iam not able to get ur probs please explain a brife to get the issue correctly ..
bye,
pap
|
|

May 4th, 2006, 04:04 AM
|
|
Authorized User
|
|
Join Date: Apr 2006
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Look!
There is a table:ID,Last Name,First Name,etc
example
1, Smith, John
1, Idol, George
2, ZZZ, Nick
2, xxx, Alex
I created a form with one list box which shows only the ID 1,2,... only
The same form has and an another list box as the example!
Now I want when I'm selecting from the first list box ID 1
in the second form to show me only
1, Smith, John
1, Idol, George
not
2, ZZZ, Nick
2, xxx, Alex
I think I helped you!
Please now Help ME!!!!
|
|

May 5th, 2006, 04:09 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Vis,
It sounds me little ...SO...u have created an from with ID (i.e. Primary Key form ur Table) and the Other Field (i.e.First & Last Name)... what u did is u uses the list box .. in my side of thinking if u want to take the action as u desire then u have to perfer the combo box and use the synchronise combo box option ...
That is u should change the first ID list in to combo box and wheh u select the ID number that the data in the corresponding filed ill shown in the below list box ..
http://support.microsoft.com/default...b;en-us;209576
U ill able to get an idea with the above link ..
bye.,
pap
---------------------------------------
Pleasure, gold, fear of life Virtue
Test by these four and trust the true. 2.1.13.501 (Tirukural)
P.A.P.Raguv
|
|

May 5th, 2006, 05:30 AM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Place two listboxes (lsbId and lsbShow), then try this:
Private Sub lsbID_Click()
Dim lngListCount As Long
Dim lngCounter As Long
Dim strSelect As String
Dim strWhere As String
Dim strSQL As String
strSelect = "SELECT ID & ', ' & Name & ', ' & Surname FROM Names"
strWhere = ""
lngListCount = Me.lsbID.ListCount
For lngCounter = 0 To lngListCount - 1
If Me.lsbID.Selected(lngCounter) Then
If strWhere = "" Then
strWhere = Me.lsbID.Column(0, lngCounter)
Else
strWhere = strWhere & ", " & Me.lsbID.Column(0, lngCounter)
End If
End If
Next lngCounter
If strWhere = "" Then
strSQL = strSelect & " WHERE False"
Else
strSQL = strSelect & " WHERE ID In (" & strWhere & ")"
End If
Me.lsbShow.RowSource = strSQL
Me.lsbShow.Requery
End Sub
|
|

May 6th, 2006, 03:38 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Weather this possible for combo box ........!?
pls give me an reply,
bye
pap
|
|

May 15th, 2006, 03:20 AM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Try
Peko
|
|

May 16th, 2006, 04:04 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have tried this but iam not getting the result ...
pls any give me an suggesion / clarification for the above issue
pap
|
|

May 19th, 2006, 03:04 AM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi, you cann't use multiselect property in Combo box, then you must modify some code, if you want select specified ID from ComboBox (cboID) and show detail information in ListBox (lsbShow):
Private Sub cboID_Click()
Dim strSQL As String
strSQL = "SELECT ID & ', ' & Name & ', ' & Surname FROM Names WHERE ID = " & Me.cboID.Value
Me.lsbShow.RowSource = strSQL
Me.lsbShow.Requery
End Sub
or, if you want select ID from ListBox (lsbID) an show details in ComboBox (cboShow), then simply replace last two rows in first example.
Me.lsbShow.RowSource = strSQL --> Me.cboShow.RowSource = strSQL
Me.lsbShow.Requery --> Me.cboShow.Requery
Peko
|
|

May 20th, 2006, 06:29 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
I want u to clarify one think i.e. I am having tow datatable called Categories & Equipments .. the Equpment table is depend on Categories table ..
For example the Categorie table contian ..Scientific Equipment , Office Equipment , Electrical Equipment..
The Equipment table come under the categorie table i.e Air Conditioner for Electrical Equip , Microscope for Scientific Equip & Pen holder for Office Equipment
What i want is in the From view when i select the Equipment name then the Category should come in the Category List box (Equipment name is in Combo box)
I have entered the Data and the from contains the combo box...!
if ur not able to understand pls reply me
bye
------------------------
pap...
|
|
 |