Link to home
Start Free TrialLog in
Avatar of Sandra Smith
Sandra SmithFlag for United States of America

asked on

include comma in name in results of VBA statement query

I have inherited a query that is created in VBA.  It is a simply select statement, "SELECT RSM FROM tblRSM".  Problem is that the names have a comma, for example, Smith, Sandra.  When the code runs the query, it recognizes the value in field(0), BUT it then assumes the value after the comma is field(1).  How do I get it to recognize the entire name value rather than it automatically assuming the value after the comma is another field?

Sandra
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sandra Smith

ASKER

This explains a lot of the problem.  Since the original programmer created this in VBA to populate a list box, I simply commented out the code and in the property for records once, selected Table/Query and created the query there.  Works properly now.  Went back and did this for all the list boxes, reduces the code but still get the same results.  Thank you.

Sandra
Good choice.  That is a far better method.  In other programming environments, the equivalent to list/combos isn't bound so you needed code to fill the RowSource.  Luckily for us, Access combos and listboxes are bound to the RowSource so no code is needed.  So, programmers who learned VB first for example, tend to write a lot more code than they need to.