UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Combox, Access 2010    
 
   
samersy
post Oct 11 2019, 04:43 PM
Post#1



Posts: 11
Joined: 20-September 19



hello
i have many comboxes , so I want if i choose the first item in main combox the other comboxes show the first item's and so on , if i choose the second item then the other comboxes show the second ..
i made this code but for one combox it is very long , is there any short code for this :
Me.h5.SetFocus
Me.h5.Dropdown
If Me.h5.Selected(0) = True Then
Me.h4.SetFocus
Me.h4.Dropdown
Me.h4.Selected(0) = True
Me.h4.Selected(1) = False
Me.h4.Selected(2) = False
Me.stduent.SetFocus
Else
Me.h5.SetFocus
Me.h5.Dropdown
If Me.h5.Selected(1) = True Then
Me.h4.SetFocus
Me.h4.Dropdown
Me.h4.Selected(0) = False
Me.h4.Selected(2) = False
Me.h4.Selected(1) = True
Me.stduent.SetFocus
Else
Me.h5.SetFocus
Me.h5.Dropdown
If Me.h5.Selected(2) = True Then
Me.h4.SetFocus
Me.h4.Dropdown
Me.h4.Selected(0) = False
Me.h4.Selected(1) = False
Me.h4.Selected(2) = True
Me.stduent.SetFocus
Go to the top of the page
 
tina t
post Oct 11 2019, 07:46 PM
Post#2



Posts: 6,194
Joined: 11-November 10
From: SoCal, USA


QUOTE
if i choose the first item in main combox the other comboxes show the first item's and so on , if i choose the second item then the other comboxes show the second

not sure what you mean by the above, can you explain more fully, pls? remember we can't see your db and don't know anything about it except what you tell us.

also, don't really understand the multiple "Selected(x)" in your code. AFAIK, a combobox can't have multiple items selected at one time. the .Value property of a combobox control holds the value in the bound column of the selected "item" from the droplist. are you actually working with a listbox control, rather than a combobox control?

hth
tina
This post has been edited by tina t: Oct 11 2019, 07:46 PM

--------------------
"the wheel never stops turning"
Go to the top of the page
 
arnelgp
post Oct 11 2019, 11:23 PM
Post#3



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...



simply put:
CODE
With Me.h4
     .SetFocus
     .DropDown
     .Value = .ItemData(Me.h5.ListIndex)
End With

--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    16th December 2019 - 07:41 AM