Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

Beginning Access 2003 VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill B. - 18 Mar 2005 06:40 GMT
Hi,

Anybody read this book by Denise Gosnell.  I like the direction but I'm
running into problems populating a combo box and then setting a selection by
value and not by numbered list - 0, 1, 2, 3, etc.  This is all unbound,
hand-coded stuff.  Basically I need to select an item in the combo box like
this:

cboPlans.SelectedValue = ParentTablePlanId

Here's what's happening right now:

If item 0 has a PlanId=0, great.
If item 1 has a PlanId=1, great.
If item 2 has a PlanId=39, not good because there are only 3 items in the
list - 0, 1 ,2.

Do I need to write my own method (routine) for this?  FYI, I've been
spending a lot of time with VB.NET and just kind of checking out Access 2003
right now.

Thanks,
Bill
Alex Dybenko - 18 Mar 2005 07:13 GMT
Hi,
dont know about this book, and code, but it looks like you should pass index
to SelectedValue, not actual value. index - is a position in list items
collection when you fill combo.

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

> Hi,
>
[quoted text clipped - 22 lines]
> Thanks,
> Bill
Albert D. Kallal - 18 Mar 2005 09:45 GMT
You don't mention how you filled the combo box in the first place?

Also, is this combo box a multi-column combo...or just ONE column?

The ms-access combo box is more then 10 years old, but in fact STILL REMAINS
likely the best combo box in terms of simplicity, and also in terms of
features (you got great features like a not in list event that you don't
have in vb).

Further, you can supply the combo box with a string delimited "value list",
or simply supply the combo with a sql string. (no connection object, no
mess, just go:

strSql  = "select id, Customer from tblCustomers where ActiveCust = True"

me.cboCombo1.RowSouce = strSql

(gee, only two lines of code to load up a whole combo box!! (how much work
and hoops do you go through to do that in .net???).

So, the first thing here to expand on is how did you fill the combo? If you
are just trying to make a "value list", then use the wizard to make the
combo for you...

Just shove your value right into the combo like:

cboPlans = PartnetTablePlanID

Also, you are using ?:

cboPlans.SelectedValue = ParentTablePlanId

A combo box does not have a SelectedValue property, so can I assume this is
typo in your post?

Signature

Albert D. Kallal   (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.members.shaw.ca/AlbertKallal

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.