[AccessD] Finding a record in a subform

Johncliviger at aol.com Johncliviger at aol.com
Mon Jul 18 09:58:34 CDT 2005


 
In a message dated 18/07/2005 15:36:01 GMT Daylight Time,  
andy at minstersystems.co.uk writes:

set  rst=Me!subThingy.Form.RecordsetClone


Hi Andy
 
Thank you for the comments. At the Form level I have the following code and  
it works just fine. 
 
Private Sub FindDealership(varDealership As Variant)
Dim LV As Variant

Dim rec As  DAO.Recordset
Dim strBookmark As  String
On Error Resume Next
LV =  Trim(varDealership)
If IsNull(varDealership)  Then
MsgBox "No Record Found",  vbInformation, "Error!"
Exit  Sub
End  If

Forms!frmOutlets.SetFocus

DoCmd.GoToControl  Forms!frmOutlets!txtName.Name

Set  rec =  Forms!frmOutlets.RecordsetClone

rec.FindFirst "[supplierID] = " & CLng(LV) ' & """"
 
    If Not rec.NoMatch  Then
strBookmark =  rec.Bookmark
Forms!frmOutlets.Bookmark = strBookmark
End If
 
    DoCmd.GoToControl  Forms!frmOutlets!txtName.Name
DoCmd.Close A_FORM,  "fdlgFind"
rec.Close

End Sub
 
 
I've since found that the line that is failing is .. I can't get it to  focus 
on the subform where the recordset 
 
 Forms![frmOutlets]![frm_Rejection]!Form.SetFocus
 
The subform frm_Rejection is both Form name and the local Name. I changed  
that but no change.
 
So...



More information about the AccessD mailing list