A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Pulling values from columns in a combo box.



 
 
Thread Tools Display Modes
  #1  
Old April 8th, 2008, 09:16 PM posted to microsoft.public.access.forms
Bretona10
external usenet poster
 
Posts: 12
Default Pulling values from columns in a combo box.

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
  #2  
Old April 8th, 2008, 09:53 PM posted to microsoft.public.access.forms
Clif McIrvin
external usenet poster
 
Posts: 40
Default Pulling values from columns in a combo box.

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


  #3  
Old April 8th, 2008, 11:26 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Pulling values from columns in a combo box.

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.

--
Dave Hargis, Microsoft Access MVP


"Bretona10" 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
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

  #4  
Old April 9th, 2008, 12:16 AM posted to microsoft.public.access.forms
Clif McIrvin
external usenet poster
 
Posts: 40
Default Pulling values from columns in a combo box.

On Apr 8, 5:26*pm, Klatuu wrote:
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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:19 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.