
Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
Here ya go:
Dim strSQL As String
Dim cmdSP As ADODB.Command
Dim theParm As ADODB.Parameter
Dim rs As ADODB.Recordset
strSQL = "SELECT AreaActivity.AAct_Value, AreaActivity.AAct_TFOnly FROM
AreaActivity "
strSQL = strSQL & "WHERE (((AreaActivity.AAct_OpAreaID)=" &
CStr(Me.cboOpArea.ItemData(Me.cboOpArea.ListIndex))
strSQL = strSQL & ") AND ((AreaActivity.AAct_DieRoll)=" & CStr(DieRoll)
strSQL = strSQL & ") AND ((AreaActivity.AAct_WarPeriod)=" &
CStr(Me.fraWarPeriod.Value) & "));"
Set cmdSP = New ADODB.Command
cmdSP.ActiveConnection = g_conn
' cmdSP.CommandText = "GetContactDensity"
' cmdSP.CommandType = adCmdStoredProc
' Set theParm = cmdSP.CreateParameter("Return", adInteger,
adParamReturnValue)
' cmdSP.Parameters.Append theParm
' Set theParm = cmdSP.CreateParameter("OpAreaID", adInteger,
adParamInput, , _
' Me.cboOpArea.ItemData(Me.cboOpArea.ListIndex))
' cmdSP.Parameters.Append theParm
' Set theParm = cmdSP.CreateParameter("DieRoll", adInteger, adParamInput,
, DieRoll)
' cmdSP.Parameters.Append theParm
' Set theParm = cmdSP.CreateParameter("WarPeriod", adInteger,
adParamInput, , Me.fraWarPeriod.Value)
' cmdSP.Parameters.Append theParm
cmdSP.CommandText = strSQL
cmdSP.CommandType = adCmdText
Set rs = cmdSP.Execute
The commented code is what is failing. The uncommented code returns the
recordset with the correct record. The string in strSQL is lifted directly
from the query named "GetContactDensity".
Here is the code to establish the connection object, although I don't see
that as the problem, since the straight text query works:
Set g_conn = New ADODB.Connection
If g_conn.State <> adStateOpen Then
If g_conn.State <> adStateClosed Then g_conn.Close
g_conn.CursorLocation = adUseClient
g_conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and
Settings\Paul\My Documents\SilentWar.mdb;" & _
"User ID=Admin;" 'No password spec uses a
blank string.
' g_conn.ConnectionString = "DSN=SilentWar"
g_conn.Open
End If
Thanks for your time on this. I really should be able to chase this down,
but I think I am too close to the problem to see what is going on.
Paul
> How about pasting the code that's failing here? Someone should be able to
> identify the problem.
[quoted text clipped - 37 lines]
> > TIA,
> > Paul