[AccessD] Finding a record in a subform

Andy Lacey andy at minstersystems.co.uk
Mon Jul 18 10:32:17 CDT 2005


John

a)You've got a bang where you need a . in front of Form

and b) It looks to me as if you need to set focus to a specific control,
thus

Forms![frmOutlets]![frm_Rejection].Form!txtxyz.SetFocus


--
Andy Lacey
http://www.minstersystems.co.uk




--------- Original Message --------
From: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
To: "accessd at databaseadvisors.com" <accessd at databaseadvisors.com>
Subject: Re: [AccessD] Finding a record in a subform
Date: 18/07/05 14:59



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...
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

________________________________________________
Message sent using UebiMiau 2.7.2




More information about the AccessD mailing list