how did you create this button?
Your code needs to look something like
Private Sub Command27_Click()
On Error GoTo Err_Command27_Click
Dim stDocName As String
stDocName = "17 CASES WITH ALL DEP POT EMANC Q"
DoCmd.OpenQuery stDocName, acNormal, acEdit
stDocName = " 18 CASES...