|
-
Oct 14th, 2011, 12:16 PM
#1
Thread Starter
Junior Member
[RESOLVED] SQL Statement
Hi, i´ve a problem with a sql statement!!!
This is my statement:
strSQL2 = "SELECT ID,txamort,aamort FROM tbltx1987 where [ID]=" & Id
strSQL2 = strSQL2 & "order by aamort asc"
Gives me a sintaxe error '[ID]=1order by aamort asc'
I have a TextBox were i write the Id. The first string gives me all records with ID=Id, in this case 1.
Anyone can help me!!
-
Oct 14th, 2011, 12:19 PM
#2
Re: SQL Statement
You need to add a space infornt of the order by
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Oct 14th, 2011, 12:23 PM
#3
Thread Starter
Junior Member
Re: SQL Statement
 Originally Posted by fmcpc
Hi, i´ve a problem with a sql statement!!!
This is my statement:
strSQL2 = "SELECT ID,txamort,aamort FROM tbltx1987 where [ID]=" & Id
strSQL2 = strSQL2 & "order by aamort asc"
Gives me a sintaxe error '[ID]=1order by aamort asc'
I have a TextBox were i write the Id. The first string gives me all records with ID=Id, in this case 1.
Anyone can help me!!
Pleople you can close this thread
I´m so stupid, lol 
I´ve been all afternoon trying to find some examples, and no one helped me out because the problem was easier...
Try to find the changes i´ve done to my statement:
Bad statement:
strSQL2 = "SELECT ID,txamort,aamort FROM tbltx1987 where [ID]=" & Id
strSQL2 = strSQL2 & "order by aamort asc"
Good statement:
strSQL2 = "SELECT ID,txamort,aamort FROM tbltx1987 where [ID]=" & Id
strSQL2 = strSQL2 & " order by aamort asc"
I will wait for an answer with the solution of the problem if anyone can see
-
Oct 14th, 2011, 12:25 PM
#4
Thread Starter
Junior Member
Re: SQL Statement
thanks for the quick answer, it was helpfull because i solved the problem 1 minute after i make this thread on forum
-
Oct 14th, 2011, 12:25 PM
#5
Re: SQL Statement
As I said in post #2 look at the second part of the SQL statement . In the first (Bad) post there is a missing space infront of the word order. In second (good) post there is a space.
Sometimes the Programmer
Sometimes the DBA
Mazz1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|