Subform works half of time

A

ANStech

I have code that opens a subform from a cmdbutton.
Here it is:

Private Sub cmdOpenCalenderPopUp_Click()
Dim strWhereCond
strWhereCond = "ID = Forms!frmBatteries!ID"
DoCmd.OpenForm "frmTestCalenders", wherecondition:=strWhereCond
End Sub

I have other code that calls this sub when a condition is met:

Private Sub opgLocation_Click()
If Me!opgLocation = 2 Then
Call cmdOpenCalenderPopUp_Click
End If
End Sub

When the cmdbutton is clicked, the subform appears, and I can add and edit
data.

When the opgLocation is clicked, and the condition is true, the subform
opens, but I cannot add or edit data. The only thing that works is the close
button.

If I then try to go back to the cmdbutton, It behaves as the opgLocation.

What am I doing wrong??
 
Top