I have a popup form that is opened by users to add a new record into the table. When the popup form is closed I have if saving the records. What I want it to do is requery the main form and find the new record just added to the table. Here is my code tha is not working.
If Me.CompanyID <> "" Then 'Check to see if new record is added
sql = "SELECT First(DNM) AS FirstDNM, First(ActDate) AS FirstActDate FROM NS_qry"
Set rs = CurrentDb.OpenRecordset(sql, 4)
Me.ActDate = rs!FirstActDate
Me.DNM = rs!FirstDNM
stLinkCriteria = "[CTracID]=" & Me![CTracID]
Forms![TempSchedule_frm].Requery
DoCmd.FindRecord (Me.CTracID), acAnywhere, True, acSearchAll, True
DoCmd.Close
Else
DoCmd.Close
End If
I do not what to filter the recordset, or use GoTo.
If Me.CompanyID <> "" Then 'Check to see if new record is added
sql = "SELECT First(DNM) AS FirstDNM, First(ActDate) AS FirstActDate FROM NS_qry"
Set rs = CurrentDb.OpenRecordset(sql, 4)
Me.ActDate = rs!FirstActDate
Me.DNM = rs!FirstDNM
stLinkCriteria = "[CTracID]=" & Me![CTracID]
Forms![TempSchedule_frm].Requery
DoCmd.FindRecord (Me.CTracID), acAnywhere, True, acSearchAll, True
DoCmd.Close
Else
DoCmd.Close
End If
I do not what to filter the recordset, or use GoTo.
Last edited: