INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Combo with multiple colums/duplicate data

Combo with multiple colums/duplicate data

(OP)
Hi,

I could do with a little orientation regarding a problem that I have with a combo that holds similar data.
My combo is linked to a table that contains more that 18,000 ports worldwide:

Table: [All_Ports]
[Id] = Auto number
[PortName] = Name of the Port
[CountryCode] = ISO Country Code
[PortCode] = ISO Port Code

The combo that I have shows has three columns: the Port Name, CountryCode and PortCode, but there's a problem:
We all live in a big world, and the are many ports with the same name!!

IE:

Id: 10889 - Newark GB NWK
Id: 10890 - Newark US EWR

And this is where my issue arises from, whenever I select Newark US EWR, I get the results for Newark GB NWK.
This is what I originally dad before the issue came to light:

ComboName = MyPort

CountryCode = DLookup("CountryCode", "All_Ports", "[PortName]=" & "[MyPort]" & "")
PortCode = DLookup("PortCode", "All_Ports", "[PortName]=" & "[MyPort]" & "")
MyPort = CountryCode & PortCode


Without showing the [Id] field in my Combo, what would be the best approach to get the correct data/port after selection?
By the way, I'm using Access 2007

Thanks guys,
JMC







RE: Combo with multiple colums/duplicate data

Your combo box bound column must be unique. You can display any column in the combo box by setting the column widths. You can display any other column value in a text box by setting its Control Source to:
=MyPort.Column(x)
Columns are numbered beginning with 0 so the x would be replaced by 1 to display the second column of the Row Source.

Duane
Hook'D on Access
MS Access MVP

RE: Combo with multiple colums/duplicate data

(OP)
Thanks for your valuable help...
Got EXACTLY what I needed with your explanation.

Star's on it way to you.
:)

RE: Combo with multiple colums/duplicate data

I would change the row source
to
Select Id,PortName & '-' CountryCode ,PortCode
From All_Ports

column count to 3

column widths to to 0";2";1"

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close