Change row source in vba, and later revert to original

G

Guest

Hi there! I'm looking for a little help regarding the following:
I have a combo box with a SQL statement as it's source.

In response to a command button event, the row source changes to a different
SQL statement.

My question: How do I revert to the original SQL statement later, in
response to a different command button event? I know that I could just set
the .rowsource property to the SQL statement, but I'm having trouble with
that because my SQL statement has some characters in it that are causing
problems in vba.
_______________
Here's what the original row source looks like:
SELECT tblContact.ContactID, tblContact.ContactDivision,
tblContact.ContactLastName, tblContact.ContactFirstName FROM tblContact WHERE
(((tblContact.ContactDivision)=Forms!frmBusDev!cboBusDevDivision)) ORDER BY
tblContact.ContactLastName;

When the event is triggered, it changes to this:
.RowSource = "SELECT tblContact.ContactID, " _
& "tblContact.ContactLastName, tblContact.ContactFirstName " _
& "FROM tblContact ORDER BY tblContact.ContactLastName;"
_______________
Is there a property already in vba that refers to the original (or default)
row source of a control before it was modified with code? I greatly
appreciate suggestions and any help you might be able to offer. Thanks!
 
G

Guest

I don't see any characters that should be causing problems such as embedded
double quotes. You can use code to place the original Row Source property
value into the Tag property. Then pull it back out when you need to reset it.
 

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