Bound Column in a Combo Box - Got a problem!

SGT68

Registered User.
Local time
Today, 20:27
Joined
May 6, 2014
Messages
76
In my form my combo box displays a list from a query called DORP-HDR that has 3 columns

DORP-ID | CODE | NAME

and displays them like that is the drop down list
The form field that the combo is bound to takes the numeric-id field as its value. In the combo control wizard i nominated that value, and in the properties pane bound column value is 1.

and in the properties pane the row source is:
SELECT [DORP HDR].[DORP-ID], [DORP HDR].
Code:
, [DORP HDR].[NAME] FROM [DORP HDR] ORDER BY [NAME]; 

So far so good. I have created lots of combo boxes before like this.

But this time i want the second field in the list (CODE) ALSO bound to another field in my form  . So I want the combo to transfer two values not one. How do i do this?
 
It may be helpful if i add this.

The combo's bound column, namely the DORP-ID field, is not a unique identifier. It forms part of a compound key with the CODE field, thats why i need both of them transferred to the form
the key is

DORP-ID
CODE

bound together. It seems that Access does not really support well this feature of compound keys that old COBOL programmers like me would take for granted. It allows them yes, but your on your own with them...
 
You might try a query for the rowsource

Select DORP_ID &
Code:
 as MyKey, [Name] 
FROM [DORP HDR]
ORDER BY [Name]

Your combo would have 2 columns

MyKey and [Name]

Also, this may be one of those situations where a composite PK may have downstream (combo box) issues.

You could have a single autonumber PK, say DORP_PK.
Then have a unique composite index on Dorp_ID,[Code]

Name and Code are probably Access reserved words and why you have used the []. Often better to avoid Reserved words and the need for [].
See Reserved word list [URL="http://allenbrowne.com/AppIssueBadWord.html"]here[/URL].

Using names for fields and objects with embedded spaces is also not considered a good practice. Better to use only alphanumerics and underscore "_".

Good luck with your project.
 
You might try a query for the rowsource

Select DORP_ID &
Code:
 as MyKey, [Name] 
FROM [DORP HDR]
ORDER BY [Name]

Your combo would have 2 columns

MyKey and [Name]

Also, this may be one of those situations where a composite PK may have downstream (combo box) issues.

You could have a single autonumber PK, say DORP_PK.
Then have a unique composite index on Dorp_ID,[Code]

Name and Code are probably Access reserved words and why you have used the []. Often better to avoid Reserved words and the need for [].
See Reserved word list [URL="http://allenbrowne.com/AppIssueBadWord.html"]here[/URL].

Using names for fields and objects with embedded spaces is also not considered a good practice. Better to use only alphanumerics and underscore "_".

Good luck with your project.[/QUOTE]

Thanks

How do i embed that into VBA?
 
Did you try changing the row source of the combo?
 

Users who are viewing this thread

Back
Top Bottom