[AccessD] Recalc Parent with out loosing place in subform?

Nicholson, Karen cyx5 at cdc.gov
Mon Jan 3 11:23:08 CST 2005


This code might help.  I needed to do an update to the record source I
was sitting on; however, sometimes that made the record drop out of the
recordsource.  If it did not drop out of the recordsource then I want my
form to return to the record it was on before it requeried.

DoCmd.SetWarnings False
Dim mypartnumber As String
mypartnumber = Trim(Me.PartNumberAM)
DoCmd.RunSQL "UPDATE tblParts INNER JOIN tblPartsAM ON
(tblParts.PartNumber = tblPartsAM.PartNumber) AND (tblParts.TCNumber =
tblPartsAM.TCNumber) AND (tblParts.ManufacturerCode =
tblPartsAM.ManufacturerCode) SET tblPartsAM.DrawingNumber =
tblParts.DrawingNumber WHERE
(((tblParts.PartNumber)=[Forms]![frmDiscrepanciesInAMandPartsTable]![Par
tNumberAM]) AND
((tblPartsAM.ProcessedUnderTN)=[Forms]![frmDiscrepanciesInAMandPartsTabl
e]![ProcessedUnderTN]));"
Me.Requery
If IsNull(DLookup("tblpartsam.PartNumber",
"qryDifferencesInAMandDatabase", "([tblPartsAM].[PartNumber]) = " & "'"
& [mypartnumber] & "'")) Then
MsgBox "Record Now Matches Parts Database", , "Record Matches"
Exit Sub
End If
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "([tblPartsAM].[PartNumber]) = " & "'" & [mypartnumber] &
"'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
DoCmd.SetWarnings True

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Robert Gracie
Sent: Monday, January 03, 2005 12:16 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Recalc Parent with out loosing place in subform?


 
 Hello, 
 This seems so silly, but I can't figure out how to cause the parent
form
(from with in the subform) to recalc WITH OUT causing the subform to
requery, and move the cursor back to the top record.

 Any ideas?? Or is this not possible??

Robert Gracie

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list