Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display current record in combo box--how? 2

Status
Not open for further replies.

gusbrunston

Programmer
Feb 27, 2001
1,234
US
I have a combo box that works well to select and display records.

However, when a record is displayed because it was chosen with navigation bars, or with page down or page up, the previous choice remains in the combo box.

How can I get the combo box to display the current record choice, even if the combo box was not used to choose the record? Or can I?

Thanks a heap.
:)
Gus Brunston
An old PICKer
padregus@home.com
 
Gus:

Need to do a little VBA coding.

In the Form's On_Current event enter this:

cboName = IDField

Of course, change the names to match what you are using for the combo box and the record ID field.

This assumes that you have the IDField as the bound column of the combo box.

This should keep your combo box in sync with the navigation buttons.

Hope this helps.
Larry De Laruelle
larry1de@yahoo.com

 
Dear Larry:

I'm sure you're sending me in the right direction. However, I get an error message that the macro "Combo361 = AlphaSTREET" can't be found.

Here's what I have for the bound column of the combo box:

Code:
SELECT [qryPropertiesForm].[AlphaSTREET] FROM qryPropertiesForm;

Here's what I put in "On Current" (Event) in form properties:

Code:
Combo361 = AlphaSTREET

I've also tried:

Code:
Combo361 = [qryPropertiesForm].[AlphaSTREET]

Does clear up what I need? Thanks so much for your attention to this.


:) Gus Brunston
An old PICKer
padregus@home.com
 
Gus:

Is AlphaStreet a bound control on your form? Is it a primary key field? If not, you may need to recreate the combo to include the record's primary key field.

In the example I gave you, my combo box contains two fields, the primary key for the record to be displayed (the bound column) and the description that I want the user to see and select from.

In this case, it is a list of clients and the two fields in the combo box are ClientID and ClientName. I also have a bound control on the form for ClientID that refers to a field in the record source for the form (a query). (You can hide the bound column by setting it's width property to zero.)

Thus, when I use the line cboSelect = ClientID, I am telling the system to find a record in the combo box where the client IDs match.

Check this out and let me know.
Larry De Laruelle
larry1de@yahoo.com

 
OK, Larry.

I know where to dig, at least. No the field is not a primary key field. It's a field to store an alphabetical description of a property by street name;

e.g., the address "12345 East Colorado Avenue" is stored in this field as "Colorado Avenue 12345 East".

The user "thinks" in terms of "...that property on Colorado Avenue, where is it on this list?..."

Maybe the this (alphabetic) field should be the primary key. Maybe I need to learn about multiple keys. So much to learn, so little time! I'll post what I come up with. Thanks so much.

:)
Gus Brunston
An old PICKer
padregus@home.com
 
Gus:

Sounds like "you can't get there from here".

You may need to rethink how the form is structured to display the data to the user. If you are interested, I'd be happy to take a look at it and offer my advice (for what that may be worth).

Let me know.
Larry De Laruelle
larry1de@yahoo.com

 
That would be great! I feel that I might be imposing. But if you'd like, I'd appreciate your comments about this form, particularly because it is representative of other forms I'm building, and suggestions would have an exponential value. How do I get the form so you can have a look at it? Can I just send a copy of the form? Do I have to send a copy of the whole database? It's 13 MB. I don't know what it would "zip" to. It's not "compiled" (I haven't gotten that far in Access yet.) I'll wait to hear from you at your convenience.
:)
Gus Brunston
An old PICKer
padregus@home.com
 
Gus:

If you could make a copy of the Db and strip out most of the data that should trim the size down. Leave just enough records so I can see what the data look like.

Zip it up and send it to my e-mail address. I use PKZip but any zip utility should work.

I'll give it a shot and let you know.
Larry De Laruelle
larry1de@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top