Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You told us that code throws Error 91, <em>"Object variable or With block variable not set"</em>. Unfortunately, you didn't indicate which line triggers the error. That forces us to guess where the problem lies.</p> <p>One issue is here:</p> <pre class="lang-vb prettyprint-override"><code>Me.Liste_choix.Recordset = rs </code></pre> <p>That attempts an assignment of one object to another. The <code>=</code> sign is sufficient for assignments with simple data types ... ie <code>MyVariable = 2</code>. However you must include the <code>Set</code> keyword with object assignments.</p> <pre class="lang-vb prettyprint-override"><code>Set Me.Liste_choix.Recordset = rs </code></pre> <p>Although you should make that change, I'm not certain that was the cause of error 91; I would have guessed Access would complain <em>"Invalid use of property"</em> instead. </p> <p>The <code>SELECT</code> statement is another problem, but again I'm uncertain whether it contributes to the error you reported. The <code>WHERE</code> clause uses a <code>Like</code> comparison with a pattern which has <code>*</code> as the wild card character. That query might return what you expect when you run it from DAO. But you're using ADO which treats <code>*</code> as just an asterisk character without any special meaning. So that query probably returns no rows when you run it from ADO. Replace <code>*</code> with <code>%</code>.</p> <p>As general advice, if your code module does not already include <code>Option Explicit</code> in its Declarations section, add it. Then run Debug->Compile from the VB Editor's main menu. Fix anything the compiler complains about. Make sure you've done those things before any further troubleshooting. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload