Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform linked to another subform

Status
Not open for further replies.

BillyL

IS-IT--Management
Jul 18, 2000
91
US
I am setting up a Call Log subform within a company main form. I have tried to mimic the Call Log subforms in the Contacts.mdb sample database that shipped with Access 2000 but am having no luck.

I have two subforms based on the tblCallLog table. One subform contains the CallDate, CallSubject, and Caller. The other subform contains the Call Notes. All of these fields are in the tblCallLog table. I have setup up a one-to-many relationship between the tblCompany table and the tblCallog table. The relationshp is between tblCompany.CompanyID and tblCallLog.fkCompanyID.

I created a frmCallLogSub subform based on the tblCallLog table. Query fields are: tblCallLog.* and CallDate (SELECT tblCallLog* FROM tblCallLog ORDER BY tblCallLog.CallDate.

I also created frmCallNotesSub based on the tblCallLog table. Query fields are CallID, fkCompanyID, Notes (SELECT tblCallLog.CallID,tblCallLog.fkCompanyID,tblCallLog.Notes FROM tblCallLog).

The only difference between my DB and the Microsoft Contact DB that I can see is in the Record Source field in the Properties of the forms. Microsoft's DB does not have brackets surrounding the fields and my DB does (MS=SELECT tblContacts.CallID...; mine=SELECT [tblCallLog].[CallID]...).

The Properties of the subforms within the main form are as follows:
CallDate subform:
MS: Rec Source=CallListSub; Child=ContactID; Master=ContactID
Mine: Rec Source=frmCallLogSub; Child=fkCompanyID; Master =CompanyID

Call Notec subform:
MS: Rec Source=CallNotesSub; Child=CallID; Master=forms!Contacts!CallListSub!CallID
Mine: Rec Source=frmCallNotesSub; Child=CallID; Master=fomrms!frmCompany!frmCallLogSub!CallID

From what I can see the code is virtually identical in MS's and mine.

The object is to enter a call log time , subject and caller in frmCalLogSUb and also enter notes in the frmCallNotesSub and have both entries inputed into the same record in th tblCallLog table.

The following happens when I enter data in the forms in my subforms:
- In frmCallLogsSubform the data seems to be entered fine, no error until I click on the Notes subform, then I get the message "You tried to assign a Null value to a variable that is not a Varient data type."
- I click OK (no real choice) and then I can enter data in the Notes subform.
- WhenI try to close or move to another record, the following message apears: "You cannot add of change a record because a related record is required in table "tblCompnys"."
- If I try to close the message tells me that I cannot save the record at this time.
- I click Yes to close anyway.
- If I open up the tblCallLog table, only the CalID, CompanyID, Date and Subject are entered.

- When I go back to the form and enter data in the frmCallLogSub and then enter data in the frCalNotesSub, no messages appear. But...
- In the tblCallLog table, the second record has been added but the Notes data has been added to the previous record and the current Notes field is blank.

I am sorry that this is so long winded, but I want to get the details across because it seems like I am missing a key and essential part of the subform setup.

Thanks in advance

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top