Programming form controls (combo box) (1 Viewer)

JMM

New member
Local time
Today, 20:34
Joined
Apr 7, 2001
Messages
9
Hi,

I have a form on which I have a combo box. I would like to load the combo box with the values from a column in a particular table, allow the the user to select records with the combo box, and enter new values for new records/update values for existing records in the combo box.

The trouble that I am having is that, when changing records with the built in Access control thing at the bottom of the screen ( Record: |< < __1__ > >| >* of X ), the selected item in the combo box does not change to match the current record. So, I am searching endlessly for documentation of this control and all I can find is a help page called "Combo Box Control Properties" which doesn't mention anything that would allow me to make a certain item in the combo box selected and I don't see any documentation of methods.

A) Is this possible?: to programatically (with VB) make a particular item in the combo box selected.

B) How do I do it/where is the appropriate documentation?

Any help or insight appreciated. Thanks.

[This message has been edited by JMM (edited 04-16-2002).]
 

Nero

Shop smart, shop S-Mart
Local time
Today, 20:34
Joined
Jan 8, 2002
Messages
217
What you need is a field to store the value in that you select from the combo box for the record.
When you create the combo box the wizard prompts you to enter a location to store the value for the selected record.
You need to point it to a holding field in your table on which the form was created.

[This message has been edited by Nero (edited 04-16-2002).]
 

David R

I know a few things...
Local time
Today, 14:34
Joined
Oct 23, 2001
Messages
2,633
You can force a combo box to do all of that, however it is fraught with peril to do so because you may wind up changing a value in your current record when you intended to lookup another record, etc. Try this topic for some help getting moving: http://www.access-programmers.co.uk/ubb/Forum4/HTML/005371.html

HTH,
David R
 

JMM

New member
Local time
Today, 20:34
Joined
Apr 7, 2001
Messages
9
Thanks for your replies.

Nero,

I think the problem with that (and with what I described) is what David mentioned -- it's too ambigous whether you are trying to select a different record or enter a new one. However, I would like to be able to make the selected item in the combo box change to match the current record, however that record is selected.

David,

Yes, I see your point. Thanks for the link, that is a good thread. I think that, if I keep this entirely in Access, I'm going to have to settle for certain things. I suppose I could always do it in VB and use ADO. That way I'd have access to the more robust VB form controls. Or am I just missing a big chunk of Access documentation? For example, IS there a way to programmatically make a particular item in the Access combo box selected? If there is, I can't find it in my help files.
 

David R

I know a few things...
Local time
Today, 14:34
Joined
Oct 23, 2001
Messages
2,633
Can you set it with Me.ComboBox.Value = [StoredField]? I know I've done this before with Value List combos, but for a lookup combo you'd have to have a way to determine what that stored value should be.
 

Users who are viewing this thread

Top Bottom