Relationships.

A

andyw

Hi,

I have two tables with a field called customerID that resides in both
of them.

I created a relationship between the two.

So when customerID is entered in the first table the plan is that value
will be there in the 2nd table as long with a few other fields.

The trouble is it appears in the form of a drop down list so it could
allow for the customerID value to be changed from the 2nd table.

Is there anyway to get this to be read only or make it so the other
values are not selectable ?

TIA.
 
1

123

andyw said:
Hi,

I have two tables with a field called customerID that resides in both
of them.

I created a relationship between the two.

So when customerID is entered in the first table the plan is that value
will be there in the 2nd table as long with a few other fields.

The trouble is it appears in the form of a drop down list so it could
allow for the customerID value to be changed from the 2nd table.

Is there anyway to get this to be read only or make it so the other
values are not selectable ?

TIA.
 
A

Arvin Meyer

You cannot lock it in the tables without implementing security and locking
out the tables from use. You shouldn't be editing in the tables anyway.
Using a form, you can easily lock the control so it can't be edited once
there is some data in it. In the form's Current event, add some code:

If Len(Me.cboBoxName & vbNullString) = 0 Then
Me.cboBoxName.Locked = True
Else
Me.cboBoxName.Locked = False
End If
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
J

John Vinson

Hi,

I have two tables with a field called customerID that resides in both
of them.

I created a relationship between the two.

So when customerID is entered in the first table the plan is that value
will be there in the 2nd table as long with a few other fields.

The trouble is it appears in the form of a drop down list so it could
allow for the customerID value to be changed from the 2nd table.

Is there anyway to get this to be read only or make it so the other
values are not selectable ?

Arvin's quite correct on the suggestion to use a Form. Note that in a
typical Form/Subform setup (with the Form based on the Customer table
and the Subform based on the related table), you would use the
CustomerID as the master/child link field; it will fill in and link
automatically. When you do this, it's not necessary to even DISPLAY
the CustomerID on the subform, much less allow it to be edited.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Top