We help IT Professionals succeed at work.

trim dropdown value before executing query

Fordraiders
Fordraiders asked
on
76 Views
Last Modified: 2017-03-10
Access 2010 vba

I have a combobox where the row source is a query.
When a value/copied and pasted./ typed into the combo box.

The query brings back the result.

I want to trim the value pasted before the query executes ?


me.cbo_Names = trim(me.cbo_names)

Thanks
fordraiders
Comment
Watch Question

crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2009

Commented:
Also, what is the purpose of trimming the value?  Trim() just removes extra space.  Do you need something more than that?
MIS Liason
CERTIFIED EXPERT
Most Valuable Expert 2012
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
just trying to remove spaces

Author

Commented:
Thanks all...
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015

Commented:
you're welcome ~ happy to help

if the combo is not limited to the list, provided it is a string, you can do this on the control After Update event:
with me.controlname
   if isnull(.value) then exit sub
   .value = trim(.value)
end with

Open in new window

Jeffrey CoachmanMIS Liason
CERTIFIED EXPERT
Most Valuable Expert 2012

Commented:
Glad you were able to get what you were after.
;-)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions