One to many relationship

S

StacieC

Hi,

I have created a db, there are 2 tables - one is tblLeads and the other is
tblCalls. In the leads form, the user can click on a button "sales activity"
to track their activity with the lead. In each table I have created a
ContactID (which is an autonumber in tblLeads and number is tblCalls). I have
created the one to many relationship between the 2 ContactIDs, but 2 things
aren't happening 1) I am not seeing a 1 or an infinity symbol on the
relationship table and 2) when the sales activity button is clicked, the
ContactID is not coming through.

I don't know if that is enough information, but any insight would be
appreciated.

Thanks,
Stacie
 
J

John W. Vinson

Hi,

I have created a db, there are 2 tables - one is tblLeads and the other is
tblCalls. In the leads form, the user can click on a button "sales activity"
to track their activity with the lead. In each table I have created a
ContactID (which is an autonumber in tblLeads and number is tblCalls). I have
created the one to many relationship between the 2 ContactIDs, but 2 things
aren't happening 1) I am not seeing a 1 or an infinity symbol on the
relationship table and 2) when the sales activity button is clicked, the
ContactID is not coming through.

For 1): click the relationship line in the relationships window and view its
properties. Is the Enforce Referential Integrity checkbox checked? If not,
check it.

2) Then presumably there is a problem with the code in the button's click
event... which we cannot see. Please post it.
 
S

StacieC

When I check the relational integrity I get an error message.

And then here is the code for the click on

Private Sub SalesActivity_Click()
On Error GoTo Err_SalesActivity_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Sales Activity"

stLinkCriteria = "[ContactID]=" & Me![ContactID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_SalesActivity_Click:
Exit Sub

Err_SalesActivity_Click:
MsgBox Err.Description
Resume Exit_SalesActivity_Click

End Sub
 
J

John W. Vinson

When I check the relational integrity I get an error message.

Ummm...

what error message?

Are you certain that the datatypes are identical in the two tables? Are the
two tables in the same database? If not then you cannot enforce RI.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top