RE: ADODB Recordset and Connection
- From: Piper <Piper@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 14 Jun 2007 14:53:00 -0700
Ok I'm getting smarter, so I think, but it still dosent work!
I’ve updated my setRcdSet and setCnxn to Function's insted of Sub's. So I
can return the Connection and ResultSet, theoretically anyway - it still
physically doesn’t work. I now have this (abbreviated version):
Sub createListBX()
Dim noPh As String, qry As String
Dim cpFrm As Form
Dim rcdSet As New ADODB.Recordset
noPh = getNme(Forms!Emp_Form!Emp_ID) + " has no Dept Issued Cell Phones."
qry = cpByIDQry(Forms!Emp_Form!Emp_ID)
Set rcdSet = setRcdSet(rcdSet, qry)
If rcdSet.EOF = True & rcdSet.BOF = True _
Then
'CP_ListBX.Height =
CP_ListBX.ColumnCount = 1
CP_ListBX.ColumnWidths = "3.75 in"
CP_ListBX.AddItem (noPh)
Else
fillListBX CP_ListBX, rcdSet
End If
cleanUpRcdSet rcdSet
End Sub
_____________________________________________________
Function setRcdSet(rcdSet As ADODB.Recordset, query As String) _
As ADODB.Recordset
Set rcdSet = New ADODB.Recordset
rcdSet.Open query, setCnxn, adOpenDynamic, adLockOptimistic, adCmdText
Set setRcdSet = rcdSet
End Function
_______________________________________________________________
Function setCnxn() As ADODB.Connection
On Error GoTo ErrorHandler
Dim cnxnStr As String
cnxnStr = "Driver={Microsoft Access Driver " _
& "(*.mdb)};Dbq=U:\PersonnelDB\CC_Personnel.mdb;"
Cnxn = New ADODB.Connection
Cnxn.CursorLocation = adUseServer
Cnxn.Open cnxnStr
Set setCnxn = Cnxn
****************
End Function
__________________________________________________________
Now I get to the part with the *'s and when I added a MsgBox with
setCnxn.State it showed a 1, so I know at that point the connection is open.
It just dosen't return an open Connection, the Connection it returns shows
Closed.
Any suggestions???
Thanks
--
Piper
.
- Follow-Ups:
- Re: ADODB Recordset and Connection
- From: roger
- Re: ADODB Recordset and Connection
- References:
- ADODB Recordset and Connection
- From: Piper
- ADODB Recordset and Connection
- Prev by Date: Re: ADODB Recordset and Connection
- Next by Date: Re: ADODB Recordset and Connection
- Previous by thread: Re: ADODB Recordset and Connection
- Next by thread: Re: ADODB Recordset and Connection
- Index(es):
Relevant Pages
|
|