Error 91

D.W. Schingenga

Registered User.
Local time
Today, 23:58
Joined
Jun 2, 2005
Messages
29
I have problems with the line below in my Dbase:

Set rst = CurrentDb.OpenRecordset("SELECT * FROM tbl_BA_Deb WHERE Debiteurennummer = " & Me.cboDebiteurennummer & " ORDER BY Debiteurennummer", dbOpenDynaset)

Every time I open de combobox and select a customer, it comes with the error 91 message, Objectvariable of Blockvariable With is not set.

Strange thing is that in another Dbase this line works fine, but in the present Dbase it does not work. The only difference is that the other Dbase has a .mdb back and the present DBase has a SQL back.

Thanks,

Dirk
 
Post the code prior to this line. It is probable that:

  • a) You have not dimensioned a Recordset object; or
  • b) You are using an ADO Recordset object with DAO code
 
The previous line contains:

Dim rst As DAO.Recordset

Dirk.
 
What's in your references list (open a module, Tools -> Referencess) ?

MS Data Access Objects or MS ActiveX Data Objects?
 
In my referencelist I have the following checked:

- Visual Basic for Applications
- Microsoft Access 10.0 Object Library
- Microsoft ActiveX Data Objects 2.5 Library
- Microsoft DAO 3.6 Object Library
- OLE Automation
- Microsoft ADO Ext. 2.8 for DDl ans Security
- Microsoft Visual Basic for Applications Extensibility 5.3
- Microsoft Windows Common Controls 6.0 (SP6)
- Microsoft Excel 10.0 Object Library

Dirk.
 
I'm not a SQL Expert by any means, but could it be that your SQL expression that includes a reference to a combobox is causing the problem?

From what I understand, you cannot use a parameterized query in SQL that way. You would have to set a parameter first and not use the control.

I may be off there, as I said, but I seem to remember something about that from a book I started reading.
 

Users who are viewing this thread

Back
Top Bottom