Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error 7965

17 views
Skip to first unread message

Maciej Franciszkowski

unread,
Nov 18, 2009, 5:13:47 AM11/18/09
to
Hello,
AfterUpdate event of ComboBox is resulting in error 7965
it is exactly in line with: "Set Me.Recordset = rs"

code below

Private Sub cboWYSZUKAJ_AfterUpdate()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strFrmNm As String

Set rs = New ADODB.Recordset
Set cn = New ADODB.Connection

Set cn = CurrentProject.Connection

rs.Open "SELECT * FROM qry99_DANE WHERE NRZLEC = CStr(" & Me!
cboWYSZUKAJ & ");", cn

Set Me.Recordset = rs

rs.Close
cn.Close

Set rs = Nothing
Set cn = Nothing
End Sub

/
Maciej

Salad

unread,
Nov 18, 2009, 5:35:25 AM11/18/09
to
Maciej Franciszkowski wrote:

What's a 7965? As in description? A lot of us haven't memorized the
error number list and their meanings. Regardless...couldn't you do
something like the following instead?
Me.Recordsource = "SELECT * FROM qry99_DANE WHERE NRZLEC = CStr(" &
Me!cboWYSZUKAJ & ");"

Unless you are changing the recordsource for some specific reason, I
might have something like this instead
Dim strF as string
If not isnull(Me.combo1) then
strF = "NRZLEC = """ & CStr(Me!cboWYSZUKAJ) & """"
Endif
msgbox "strF is " & strF 'remove/comment out after debugging
Me.filter = strF
Me.FilterOn = (strF > "")
to filter or remove the filter on the existing recordsource.

0 new messages