Solved

SQL and Visual Basic (VB 5)

Posted on 1998-11-26
2
130 Views
Last Modified: 2013-11-25
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
Comment
Question by:altecjjf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
kamall earned 100 total points
ID: 1447020
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
 

Author Comment

by:altecjjf
ID: 1447021
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question