Attribute VB_Name = "basCalls2Queries"
Option Explicit

Public Function Exec_qry_del_Customers(ByVal strCustomerID As StringAs Long
  Dim strSQL As String
  Dim objCmd As New ADODB.Command

  On Error GoTo PROC_ERR

  strSQL = "qry_del_Customers"
  With objCmd
    .Commandtext = strSQL
    .Commandtype = adCmdStoredProc
    Set .ActiveConnection = g_objCn

    .Parameters.Append .CreateParameter("pCustomerID", adVarWChar, adParamInput, 5, strCustomerID)

    .Execute Options:=adExecuteNoRecords
  End With

  Set objCmd = Nothing

  Exec_qry_del_Customers = 0
  Exit Function
  PROC_ERR:
  Exec_qry_del_Customers = Err.Number
End Function

Public Function Exec_qry_sel_Customers(ByVal strCustomerID As String, ByRef objRs As ADODB.Recordset) As Long
  Dim strSQL As String
  Dim objCmd As New ADODB.Command

  On Error GoTo PROC_ERR

  strSQL = "qry_sel_Customers"
  With objCmd
    .Commandtext = strSQL
    .Commandtype = adCmdStoredProc
    Set .ActiveConnection = g_objCn

    .Parameters.Append .CreateParameter("pCustomerID", adVarWChar, adParamInput, 5, strCustomerID)
    objRs.Open objCmd
  End With

  Set objCmd = Nothing

  Exec_qry_sel_Customers = 0
  Exit Function
  PROC_ERR:
  Exec_qry_sel_Customers = Err.Number
End Function

Public Function Exec_qry_ins_Customers(ByVal strCustomerID As StringByVal strCompanyName As StringByVal strContactName As StringByVal strContactTitle As StringByVal strAddress As StringByVal strCity As StringByVal strRegion As StringByVal strPostalCode As StringByVal strCountry As StringByVal strPhone As StringByVal strFax As StringAs Long
  Dim strSQL As String
  Dim objCmd As New ADODB.Command

  On Error GoTo PROC_ERR

  strSQL = "qry_ins_Customers"
  With objCmd
    .Commandtext = strSQL
    .Commandtype = adCmdStoredProc
    Set .ActiveConnection = g_objCn

    .Parameters.Append .CreateParameter("pCustomerID", adVarWChar, adParamInput, 5, strCustomerID)
    .Parameters.Append .CreateParameter("pCompanyName", adVarWChar, adParamInput, 40, strCompanyName)
    .Parameters.Append .CreateParameter("pContactName", adVarWChar, adParamInput, 30, strContactName)
    .Parameters.Append .CreateParameter("pContactTitle", adVarWChar, adParamInput, 30, strContactTitle)
    .Parameters.Append .CreateParameter("pAddress", adVarWChar, adParamInput, 60, strAddress)
    .Parameters.Append .CreateParameter("pCity", adVarWChar, adParamInput, 15, strCity)
    .Parameters.Append .CreateParameter("pRegion", adVarWChar, adParamInput, 15, strRegion)
    .Parameters.Append .CreateParameter("pPostalCode", adVarWChar, adParamInput, 10, strPostalCode)
    .Parameters.Append .CreateParameter("pCountry", adVarWChar, adParamInput, 15, strCountry)
    .Parameters.Append .CreateParameter("pPhone", adVarWChar, adParamInput, 24, strPhone)
    .Parameters.Append .CreateParameter("pFax", adVarWChar, adParamInput, 24, strFax)

    .Execute Options:=adExecuteNoRecords
  End With

  Set objCmd = Nothing

  Exec_qry_ins_Customers = 0
  Exit Function
  PROC_ERR:
  Exec_qry_ins_Customers = Err.Number
End Function

Public Function Exec_qry_upd_Customers(ByVal strCustomerID As StringByVal strCompanyName As StringByVal strContactName As StringByVal strContactTitle As StringByVal strAddress As StringByVal strCity As StringByVal strRegion As StringByVal strPostalCode As StringByVal strCountry As StringByVal strPhone As StringByVal strFax As StringAs Long
  Dim strSQL As String
  Dim objCmd As New ADODB.Command

  On Error GoTo PROC_ERR

  strSQL = "qry_upd_Customers"
  With objCmd
    .Commandtext = strSQL
    .Commandtype = adCmdStoredProc
    Set .ActiveConnection = g_objCn

    .Parameters.Append .CreateParameter("pCustomerID", adVarWChar, adParamInput, 5, strCustomerID)
    .Parameters.Append .CreateParameter("pCompanyName", adVarWChar, adParamInput, 40, strCompanyName)
    .Parameters.Append .CreateParameter("pContactName", adVarWChar, adParamInput, 30, strContactName)
    .Parameters.Append .CreateParameter("pContactTitle", adVarWChar, adParamInput, 30, strContactTitle)
    .Parameters.Append .CreateParameter("pAddress", adVarWChar, adParamInput, 60, strAddress)
    .Parameters.Append .CreateParameter("pCity", adVarWChar, adParamInput, 15, strCity)
    .Parameters.Append .CreateParameter("pRegion", adVarWChar, adParamInput, 15, strRegion)
    .Parameters.Append .CreateParameter("pPostalCode", adVarWChar, adParamInput, 10, strPostalCode)
    .Parameters.Append .CreateParameter("pCountry", adVarWChar, adParamInput, 15, strCountry)
    .Parameters.Append .CreateParameter("pPhone", adVarWChar, adParamInput, 24, strPhone)
    .Parameters.Append .CreateParameter("pFax", adVarWChar, adParamInput, 24, strFax)

    .Execute Options:=adExecuteNoRecords
  End With

  Set objCmd = Nothing

  Exec_qry_upd_Customers = 0
  Exit Function
  PROC_ERR:
  Exec_qry_upd_Customers = Err.Number
End Function