You told us that the code calls Error 91, "Object variable or With block variable not set". Unfortunately, you did not indicate which line is causing the error. This makes us guess where the problem lies.
One problem:
Me.Liste_choix.Recordset = rs
This is an attempt to assign one object to another. The = sign = sufficient for assignments with simple data types ... i.e. MyVariable = 2 . However, you must specify the Set keyword with the purpose of the objects.
Set Me.Liste_choix.Recordset = rs
Although you should make this change, I'm not sure if this was the cause of error 91; I would have guessed that Access would complain about "Inappropriate use of property."
The SELECT operation is another problem, but again I am not sure if it contributes to the error message. The WHERE uses a Like comparison with a pattern that has * as a wildcard symbol. This query may return what you expect when you start it from the DAO. But you are using ADO, which treats * as an asterisk character without any special meaning. Thus, the query probably does not return any rows when starting from ADO. Replace * with % .
As a general tip, if your code module does not yet include Option Explicit in the "Ads" section, add it. Then run Debug-> Compile from the VB Editor main menu. Fix everything the compiler complains about. Make sure you do these things before further troubleshooting.
Hansup
source share