Link to non-attached subform not working

sandy6078

Take a deep breath
Local time
Today, 17:38
Joined
Jul 17, 2007
Messages
135
Hi super forum gurus

I have what I hope is a simple problem. On tab D4 I have 2 subforms. The subforms are summary information and are not editable. When the user clicks on the statement text box, an edit form opens. The top subform performs as expected. The bottom subform does not when I click the text box for the bottom form, the linked edit form is blank.

I am using this code.

Code:
Dim strDocName As String
   Dim strLinkCriteria As String
      
   strDocName = "fEditEscapePoint"
   strLinkCriteria = "[EPointID] = " & Me![EPointID]
   DoCmd.OpenForm strDocName, , , strLinkCriteria
I have also tried
Code:
"[EPointID] = Forms![fInformation]![childEscapePoint].Form![EpointID]"
with the same failed result

I have also compacted and repaired the database.

Thank you for your time.

Sandy
 
You are treating the [EPointID] field an though it is numeric. Is that the case? The results you are getting indicate that there is no matching record for "[EPointID] = " & Me![EPointID]. You could do this:
Code:
strLinkCriteria = "[EPointID] = " & Me![EPointID]
[COLOR="Red"]MsgBox strLinkCriteria[/COLOR]
DoCmd.OpenForm strDocName, , , strLinkCriteria
...to see what filter is being applied. Are you sure the value has been saved in the RecordSource of the next form?
 
The values are in the record source.

It appears that the link is for the 8DID field. All three records have show the value "3" which is the 8DID value. The record source for the form EditEscapePoint does not have an 8DID field.

The subform on the tab of the main form is based on this query.

SELECT tEscapePoint.EPointID, tEscapePoint.EscapePointStatement, tRootCause.RCID, tRootCause.[8DID]
FROM tRootCause INNER JOIN tEscapePoint ON (tRootCause.RCID = tEscapePoint.RCID) AND (tRootCause.RCID = tEscapePoint.RCID);

I need to show all escape point records for the fk 8DID in the subform on the tabbed main form.
 
Okay I have solved my problem. It was a really stupid DOH! moment on my part. I had the control name as 8DID. That's what I get for cutting and pasting.

Thanks for your help Rural Guy.

MsgBox strLinkCriteria helped me find the way.
 

Users who are viewing this thread

Back
Top Bottom