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 / Forms / April 2008

Tip: Looking for answers? Try searching our database.

Pulling values from columns in a combo box.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bretona10 - 08 Apr 2008 21:16 GMT
I have a combo box that is populated from a table. It has two columns. I want
to take the value from the second column and fill in a field elsewhere on the
form, on the afterupdate property. Right now i am using a macro to fill in
other fields, so would like to use the setvalue function in a macro.

Thank you,
Bret
Clif McIrvin - 08 Apr 2008 21:53 GMT
Bret, I find the built-in helps useful, tho it took me some serious
time to figure out how to use them successfully!

I think you want the .column property of the combo box (assuming
that you cannot simply set the bound column property to 2).

I know how to use it in VBA code; guess I'm not sure in a macro.
I just looked and it wasn't in the expression builder list for one of
my combo boxes.

in any event, the column index counts from 0, so to use the 2nd
column you would use

Me.otherField = Me.yourComboBox.Columns(1) to get the value
of the 2nd column in the first row.

typing 'column property' in the help search box pulled up 'Properties
of list boxes, combo boxes, (etc)'

--
Clif

On Apr 8, 3:16 pm, Bretona10 <Breton...@discussions.microsoft.com>
wrote:
> I have a combo box that is populated from a table. It has two columns. I want
> to take the value from the second column and fill in a field elsewhere on the
[quoted text clipped - 3 lines]
> Thank you,
> Bret
Klatuu - 08 Apr 2008 23:26 GMT
This is a good place to start learning VBA.  It is simple and, in this case,
easier than using a macro.
Use the After Update event of the combo.  Clif is correct in his advise
except a minor syntax error,  it is Column without an S.

As you progress, you will be more and more frustrated with the limitiations
of macros.  One easy way to start understanding VBA is to convert a macro to
VBA and compare the macro to the code.
Macro's have limits.  Error trapping is almost impossible.
You will find that most professionals very seldom, if ever, use them.

Signature

Dave Hargis, Microsoft Access MVP

> I have a combo box that is populated from a table. It has two columns. I want
> to take the value from the second column and fill in a field elsewhere on the
[quoted text clipped - 3 lines]
> Thank you,
> Bret
Clif McIrvin - 09 Apr 2008 00:16 GMT
> This is a good place to start learning VBA.  It is simple and, in this case,
> easier than using a macro.
> Use the After Update event of the combo.  Clif is correct in his advise
> except a minor syntax error,  it is Column without an S.

Minor, but definately critical!

Thanks for catching it <g>

--
Clif
 
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.