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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SubMask Problem

Status
Not open for further replies.

darkwraith

Programmer
May 26, 2003
44
IT
Hi, I'm sorry I had posted this message in the wrong forum before. Here I think it's better.
I have a submask that lists only some fields of all the records of a table and, in the same mask in which the submask is included, some textboxes filled with other fields referring only to the selected record in the submask.
I set the source property of both mask and submask to the same table. Now I want to link the fields, that mean that if I select a record in the submask I want that data in the mask textboxes should refer to that particular record. The problem is that if I use LinkChildFields and LinkMasterFields property it is visible in the submask only a record and not the whole list.
Anyone has a suggestion?
Thanks in advance.


 
So basically you want to set the focus on the main form to the record you select in the subform...
Clear LinkChildFields and LinkMasterFields properties.
Paste the function below in a module:

Code:
Function SearchRecord(frm As Form, WhatToSearch As String) As Boolean
With frm.RecordsetClone
.Findfirst WhatToSearch
If Not .nomatch Then
frm.Bookmark = .Bookmark
SearchRecord = True
End If
End With
End Function

For the Current event of the subform:
Code:
Private Sub Form_Current()
Call SearchRecord(Me.Parent.Form, "RecordIDField" = Me!RecordIDField)
End Sub

You could also use the Filter property:
Code:
Private Sub Form_Current()
Me.Parent.Form.Filter="RecordIDField" = Me!RecordIDField
Me.Parent.Form.FilterOn = True
End Sub

Using the search function will leave all main records available, whereas the Filter will leave only one record.

HTH


[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top