Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 132
  • 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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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