Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > sql select problem


Reply
 
Thread Tools Display Modes
  #1  
Old 05-12-2004, 03:22 AM
RuffRyder RuffRyder is offline
Regular
 
Join Date: Apr 2003
Location: Gangstaville, USA
Posts: 70
Default sql select problem


got a little problem here. can somebody tell me what's wrong with this one? i want to search a customer id in my table (like "L00003") but when i execute this, i get the error: "The Microsoft Jet Database engine could not find the object 'SELECT * FROM REKKL#BK6 WHERE Rknr = 'L00003''. Make sure the object exists and that you spell its name and the path name correctly."
(using dbgrid)
Code:
sql = "SELECT * FROM REKKL#BK6 WHERE Rknr = '" & strSearch & "'" Data1.RecordSource = sql 'gives error here: Data1.Refresh

thx
RuffRyder
__________________
I Only Walk In The Dirt, But My Steps Are Guided, And No Matter How Dark My Path Gets, I Light It...

Last edited by RuffRyder; 05-12-2004 at 03:28 AM.
Reply With Quote
  #2  
Old 05-12-2004, 03:32 AM
RedLeader's Avatar
RedLeader RedLeader is offline
Centurion
 
Join Date: Jan 2004
Location: Bulgaria
Posts: 121
Default

Try this

sql = "SELECT * FROM REKKL#BK6 WHERE Rknr = " & strSearch & ""

or
sql = "SELECT * FROM REKKL#BK6 WHERE Rknr = '" & strSearch
Reply With Quote
  #3  
Old 05-12-2004, 03:52 AM
RuffRyder RuffRyder is offline
Regular
 
Join Date: Apr 2003
Location: Gangstaville, USA
Posts: 70
Default

nope, i've tried:
= '" & strSearch & "'"
= " & strSearch & "'"
= '" & strSearch
= strSearch"
= 'strSearch'"
but nothing worked out

(don't know if this has anything to do with it, but i'm working with a dBase IV table (don't ask ))
__________________
I Only Walk In The Dirt, But My Steps Are Guided, And No Matter How Dark My Path Gets, I Light It...
Reply With Quote
  #4  
Old 05-12-2004, 03:56 AM
malloc malloc is offline
Senior Contributor
 
Join Date: Feb 2004
Location: The land of Oz
Posts: 851
Default

I think you should try:
Code:
[REKKL#BK6]
Instead of:
Code:
REKKL#BK6
"#" is used by SQL to define dates. (like #12/05/2004#)
__________________
malloc

-| Use [vb][/vb] tags | Forum guidelines | Get FireFox | Google |-
Reply With Quote
  #5  
Old 05-12-2004, 04:03 AM
RuffRyder RuffRyder is offline
Regular
 
Join Date: Apr 2003
Location: Gangstaville, USA
Posts: 70
Default

nope, doesn't work, it shows:
"Make sure it is a valid parameter or alias name, that it doesn't include invalid characters or punctuation, and that the name isn't too long."
checked MSDN and apparently you can't use [] according to the DAO naming conventions
__________________
I Only Walk In The Dirt, But My Steps Are Guided, And No Matter How Dark My Path Gets, I Light It...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
another SQL problem pinkcat Database and Reporting 25 02-10-2004 08:52 AM
SQL Select iwth date problem shiv_379 Database and Reporting 1 01-22-2004 05:06 AM
sql query problem yuliam Database and Reporting 12 01-14-2004 07:21 AM
problem with multiple SELECT, INSERT and UPDATE SQL statements in DLL with ADO 2.7 lounge56 Database and Reporting 5 01-14-2003 08:38 PM
SQL Syntax Problem pw2374 Database and Reporting 1 07-24-2002 07:56 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->