Why my query opens after running my code?

A

Al

I have a form that I use to send email using CDO method. The form has a list
box with the multi select property is set to Extended. the code loops through
the selections made in the list box then send the email. everything goes well
except that the row source of the list box opens in the data sheet view after
running the code. I have nothing in the code that tells it to open. The
following code shows the only time that this query is mentioned:

sql = "SELECT * FROM qryfrmEmail"
Set db = CurrentDb
Set rs = db.OpenRecordset(sql, dbOpenDynaset)

any idea?
thanks
 
D

Dirk Goldgar

Al said:
I have a form that I use to send email using CDO method. The form has a
list
box with the multi select property is set to Extended. the code loops
through
the selections made in the list box then send the email. everything goes
well
except that the row source of the list box opens in the data sheet view
after
running the code. I have nothing in the code that tells it to open. The
following code shows the only time that this query is mentioned:

sql = "SELECT * FROM qryfrmEmail"
Set db = CurrentDb
Set rs = db.OpenRecordset(sql, dbOpenDynaset)

any idea?
thanks


That code cannot open the query in datasheet view. Look harder for the code
that opens the query.
 
J

JonWayn

Put a break point or a Stop command at the end of your loop and you can step
thru and see what statement gets executed when the datasheet opens
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top