Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
OK, here's my question. I have a unbound field on a form called fldSubcontractor. This auto-fills based on fldEquipmentID. This works fine - here is my control source:
=DLookUp("[fldSubcontractorID]","tblEquipment","[fldEquipmentID] = Form![fldEquipmentID]")
The field fldSubcontractorID from the tblEquipment table is linked to a query. The first field of the query is the primary key field, which is an AutoNumber field, and the second field is the 3-letter abbreviation for the subcontractor. My properties for this are set to 2 Columns, 0";1" Width, and the Bound Column is 2. The data type for the fldSubcontractorID field is Text. I did this because I want the 3-letter abbreviation for the sub to show on the form instead of the primary key field. However, I know this is not how I should do this. The bound column in my query should be the primary key field, and the data type for the fldSubcontractorID should be Number so that I can set up my table relationships properly.
How can I configure this so that I can set the bound column as the primary key in the query but display the abbreviation on the form? Thanks.

You don't have to have your primary key as number? You can easily set the primary key in table design to any field you choose. Just remember that the data in the primary key field should not be duplicated. If you do want to make your primary key an autonumber field, then just add a new field to the table and make it the primary key. You cannot set up a primary key through a query, unless it is a make table query or create tbale SQL
David

![]() |
Access 97 - Save as HTML
|
Local datasource advice n...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |