I need to copy a record on a form that is bound to a table. I have a button to copy the record and that works fine. Problem is finding the two records again. I decided to use a filter when I click on the copy record button. This works fine also. But, if I want to make a copy of the record that I just changed, my code used the value of the first record in the field that I am using as my criteria instead of the one being displayed on my screen. Requery and Refresh don't seem to work. I'm missing something simple here. Here is the code. Thanks, Jody
Private Sub cmdCopy_Click()
On Error GoTo Err_cmdCopy_Click
Dim varY As String
Dim varName As String
'Me.NAFTA_FILE_NAME.SetFocus
'Me.Filter = "[NAFTA FILE NAME] = Forms![F-Entry Form-PVC COO]![NAFTA FILE NAME]"
'Me.FilterOn = False
varY = Forms![F-Entry Form-PVC COO]![NAFTA FILE NAME]
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryCopyPVC"
DoCmd.SetWarnings True
Me.Requery
'DoCmd.FindRecord varY, , , , , acAll, True
'DoCmd.ApplyFilter , "[NAFTA FILE NAME] = Forms![F-Entry Form-PVC COO]![NAFTA FILE NAME]"
'Me.FilterOn = True
Exit_cmdCopy_Click:
Exit Sub
Err_cmdCopy_Click:
MsgBox Err.DESCRIPTION
Resume Exit_cmdCopy_Click
End Sub
Private Sub cmdCopy_Click()
On Error GoTo Err_cmdCopy_Click
Dim varY As String
Dim varName As String
'Me.NAFTA_FILE_NAME.SetFocus
'Me.Filter = "[NAFTA FILE NAME] = Forms![F-Entry Form-PVC COO]![NAFTA FILE NAME]"
'Me.FilterOn = False
varY = Forms![F-Entry Form-PVC COO]![NAFTA FILE NAME]
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryCopyPVC"
DoCmd.SetWarnings True
Me.Requery
'DoCmd.FindRecord varY, , , , , acAll, True
'DoCmd.ApplyFilter , "[NAFTA FILE NAME] = Forms![F-Entry Form-PVC COO]![NAFTA FILE NAME]"
'Me.FilterOn = True
Exit_cmdCopy_Click:
Exit Sub
Err_cmdCopy_Click:
MsgBox Err.DESCRIPTION
Resume Exit_cmdCopy_Click
End Sub