Hi guys, hope you can help me out on this. Sorry if this is the wrong group
to post to. I was not sure if I should post to here or the SQL group. I
did post to the SQL group as well but i have not had a response in a couple
of days so I thought maybe it was the wrong group. But my problem is that
when I am trying to connect to SQL Server I am getting the error:

-2147467259 - [DBMSSOCN]General network error. Check your network documentation.


Now, I do not get the error on the same line of code all the time. It can
be on a different line, in a different function, and I do not get it when
I step through the code, and sometimes it works perfectly. It generally
gives the error in one of the functions *after* I open a different form and
execute a stored procedure that returns records. I have several functions
that return values retrieved from SQL Server. These functions are located
at the module level. Here is a sample of what one of the functions looks
like:

Function Get_Product_FBMCONV(ByVal pID As Long) As Double
On Error GoTo errH
Dim rs As ADODB.Recordset

Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "Select [FBMCONV] from INVENTORY_MASTER where [ID]
= " & pID, "Provider=SQLOLEDB;Server=TestServer;Database=BayridgeTest;
Trusted_Connection=No;UID=sa;PWD;", adOpenStatic, adLockReadOnly,
adCmdText
Set rs.ActiveConnection = Nothing

If rs.EOF Then Get_Product_FBMCONV = 0 Else Get_Product_FBMCONV = rs!FBMCONV
rs.Close
Set rs = Nothing
errH:
If Err <> 0 Then If ErrP("Get_Product_FBMCONV", Err) = 0 Then Resume
Next Else Resume
End Function

I am a little baffled by the error because I am pretty sure there is not
a problem with the network because I can open any other form and establish
a connection with no problem.

Any help/suggestions appreciated.

Thanks,

Darcey