Private Sub btnCS_Click()
Dim strSQL As String
Dim strCn As String
strCn = "ODBC;Description=XYZ;DRIVER=SQL Server;SERVER= XYZ;Trusted_Connection=Yes;APP=2007 Microsoft Office system;"
strSQL = "usp_EgatePledgeSchedule " & Me.txt_strHM & ", " & Me.txt_strHMP & ", '" & _
Format(Me.txt_strSD, "yyyy-mm-dd") & "', '" & Me.txt_strFreq & "', " & Me.txt_strGID & ";" ' <-- Note I removed quotes around GID - it's declared as INT in the SP
With CurrentDb.CreateQueryDef(vbNullString) ' <-- pass empty string as query name
.Connect = strCn
.SQL = strSQL
.ReturnsRecords = False
.Execute dbFailOnError
End With
End Sub