Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 134
  • Last Modified:

SQL and Visual Basic (VB 5)

DataCustomer.RecordSource = "Select * from Customers where Customer_ID = " & UserInputByCustomerID
DataCustomer.Refresh

This works for a number, but not for text. How can i get this SQL to work from a Access database to access a record for somebody's last name.  
0
altecjjf
Asked:
altecjjf
1 Solution
 
kamallCommented:
Change it to:
DataCustomer.RecordSource = "Select * from Customers where Customer_ID = '" & UserInputByCustomerID & "'"

Note that the string must be between two single quotation marks ' '.
Regards
0
 
altecjjfAuthor Commented:
The SQL is correct now, but i get a data mismatch error. I think i might be able to figure it out, but do you know what it could be? Thanks Again
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now