473,544 Members | 2,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADO-SQL LIKE

Hey.

Using Access ADP and MSDE.

can some one please tell me what is wrong with this SQL string using
ADO. I get an error somewhere around the LIKE statement.

.Source = "SELECT tblCustomer.Fir stName,
tblCustomer.Las tName, tblCustomer.Pos tCode " & _
"FROM tblCustomer " & _
"WHERE (FirstName LIKE '%" &
Form("txtSearch FirstName") & "%');"
Thanks a lot.
GAVO

Nov 23 '05 #1
2 2647
My guess is that there is something wrong with
Form("txtSearch FirstName")
as I have tested your syntax and it seems to work.
What is Form? Do you mean Me.txtSearchFir stName.Value or
Me.txtSearchFir stName.Text? Could you use just txtSearchFirstN ame?
Could Me.txtSearchFir stName.Value be NULL?

I would try
debug.print "SELECT tblCustomer.Fir stName,
tblCustomer.Las tName, tblCustomer.Pos tCode " & _
"FROM tblCustomer " & _
"WHERE (FirstName LIKE '%" &
Form("txtSearch FirstName") & "%');"
and examine the string carefully.

Nov 23 '05 #2
Thanks Lylefair.
The code was fine, the problem was that I was running the code from a
"onClick" on a label and thefore the text box "txtSearchFirst Name"
never lost its focus and I believe did not save the value, so what I
did is, I set the focus on a different control before running the SQL
and its now working.

Thanks

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3155
by: George W. Jackson | last post by:
Hi to all. We have a Microsoft Access 2002 database that is referencing the ADO 2.5 library (as well as the DAO 3.6 library). On the development machine, the database works exactly as planned and all functions compile and work. When the database is packaged as a runtime version, and installed on another machine, errors occur relating to...
10
1465
by: JB | last post by:
I've been away from Access for awhile and am now returning. When I left, ADO had arrived on the scene, but most people were still using DAO. Could someone point me towards some industry statements and opinions as to which you should be using for new Access development today, and to some more enlghtened Usenet arguments about the same...
11
7379
by: Jon Smith via DotNetMonster.com | last post by:
Hi all, I'm new to C# and am practising the language by writing simple contact manager programmes. I'm having a problem using ADO. I'm trying to connect to an Access 2000 database using ADO.Net. When compiling I'm getting the following error : The type or namespace name 'ADO' does not exist in the class or namespace 'System')are you...
8
4378
by: What-a-Tool | last post by:
I have an array (2 Dimensional) which has been filled from a text file and want to load these several hundred fields into my db, which consists of 3 tables(each of which will be receiving a portion of this data) I also want to be able to do the reverse > load my db into an array for processing into a report. I've worked with several...
5
6489
by: Peter Schoots | last post by:
I am an amateur programmer and trying to move from VB6 to VB.net. I can't figure out how to create a ADO.NET database in code. I know how to create a dataset and wonder whether there is a way to "export" it into a new empty database. Since I am at it: How do you programmatically store a query into an ADO database? I am using ADOX to...
3
10059
by: Bruce Wood | last post by:
I know that this isn't a C# question, but I can't find a newsgroup specifically devoted to ADO.NET, other than a moribund one that deals with ADO in general. This problem is driving me to distraction. Maybe someone else has run across the same thing. I'm using ODBC to build a joined table in ADO.NET. The table has a large number of...
32
12479
by: robert d via AccessMonster.com | last post by:
I'm looking at converting DAO to ADO in my app. All of my DAO connections are of the following structure: Dim wsName As DAO.Workspace Dim dbName As DAO.Database Dim rsName As DAO.Recordset Set wsName = DBEngine.Workspaces(0) Set dbName = wsName.OpenDatabase(CurrentProject.FullName) Set rsName = dbName.OpenRecordset("SQL Statement")
0
1583
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/adonetprogmsdn.asp Introduction In the .NET Framework, Microsoft introduces ADO.NET, an evolution of the data access architecture provided by the Microsoft® ActiveX® Data Objects (ADO) programming model. ADO.NET does not replace ADO for the COM programmer;...
13
2504
by: Barry Edmund Wright | last post by:
hi, I started a project with a company who hired two Access developers because of the tight timeline. Problem, I use DAO the other developer uses ADO. I believe we can use both ADO and DAO by putting the DAO reference first and then the ADO if he fully qualifies all the ADO declarations. Is this correct? Any comments appreaciated.
12
1561
by: Kevinp | last post by:
Just a silly question probably... I made the switch from VB6 to VB2005 when 2005 came out. Now I'm using 2008. When I started programming, VB5 was just out and I was using RDO. I loved ADO when it came out and quickly switched all my programs to use it. I've tried to make the switch to ADO.NET, but just can't seem to figure out what I'm...
0
7438
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7632
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7392
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5931
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5309
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4930
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3422
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
996
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.