I have used Dcount in the past to check for an existing record then if not used openargs to create a new one like:
On Error GoTo Err_OpenRisk_Click
Dim stDocName As String
stDocName = "frmPPERisks1"
'Checks the table for duplicate entries prior to passing OpenArgs array if true goes to In List Sub.
If DCount("*", "tblPPERisks1", "[FormID] = " & Me.FormID & "And[PPEID]=" & Me.PPEID) = 0 Then
Else
GoTo In_List_Click
End If
'Opens the specified form and puts selected records into an array for use in the SplitMod Module which
'is activated in the form On Load code which seperates the array into seperate string values for use
' as OpenArgs which are the allocated to the form fields
DoCmd.OpenForm stDocName, , , , acAdd, acDialog, Forms![Form1].[FormID] & ";" & Me.PPEDescription & _
";" & Me.PPEType & ";" & Forms![Form1].[SiteID] & ";" & Me.PPEID & ";" & Forms![Form1].[DepartmentID] _
& ";" & Forms![Form1].[EmployeeID]
Exit Sub
In_List_Click:
If MsgBox("The PPE Item already has a risk assessment do you wish to view it?", vbYesNo) = vbNo Then
GoTo Exit_OpenRisk_Click
Else
stLinkCriteria = "[FormID]=" & "" & Me![FormID] & "" & " AND [PPEID]=" & "" & Me![PPEID] & ""
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit Sub
Exit_OpenRisk_Click:
Exit Sub
Err_OpenRisk_Click:
MsgBox err.Description
Resume Exit_OpenRisk_Click
End Sub
Don't know if this will help but seems your trying to do a similar thing?
regards John
