We help IT Professionals succeed at work.

VBA syntax question

iptrader
iptrader asked
on
305 Views
Last Modified: 2012-06-21
I have a search form that returns values in a subform.  I recently added a field to this search form, but there is a problem.  Below is the code that applies the LIKE statement to the querydef:

If Not IsNull(Me.VendItem) Then
strWhere = strWhere & "(itemvend1.[vend-item]) Like '*" & Me.VendItem & "*' AND "
End If

If VendItem contains "#", the search will come up null.  The SQL works fine, I am sure it is a syntax issue.  Could someone assist me with this?

Thanks.  Please let me know if you have any questions.

IPT
Comment
Watch Question

Author

Commented:
BTW, I have tried different variations of the syntax and have come up empty :)
try replacing # with % ?

John

Author

Commented:
John, the field name is set in the table.  I am pulling it in the dropdown box directly with SELECT DISTINCT string.

Thanks,

IPT
MS Access Systems Creator
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Hi jack,

Unfortunately a lot of our users are on Access2K.

Any tips?

Thanks,

IPT

Author

Commented:
Jack, also, the data is legacy data.  Nothing can be done about that.  Sorry.

IPT
CERTIFIED EXPERT
Top Expert 2004

Commented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

Accept/jadedata

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

RoutineT
EE Cleanup Volunteer
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.