Avatar of Sandra Smith
Sandra Smith
Flag 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
Microsoft AccessMicrosoft Development

Avatar of undefined
Last Comment
PatHartman

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
PatHartman

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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
PatHartman

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.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck