Solved

adodc1

Posted on 2009-07-12
5
284 Views
Last Modified: 2013-12-26
How to correct my code in ado RecordSource?


select s.proname as [Item Description], s.Procode as[Item Code], s.Quantity , um as [UOM], s.sellingprice as [Price 1],s.vndrid as [Supplier],pricea as [Price 2], priceb as [Price 3]  from stock s inner join typediscount t on s.procode=t.proid order by  s.vndrid='" text1.text & "'"

Open in new window

0
Comment
Question by:Whing Dela Cruz
  • 3
  • 2
5 Comments
 
LVL 6

Assisted Solution

by:microbolt
microbolt earned 500 total points
ID: 24835630
You missing and & near text1.text.  Correct code is below:
select s.proname as [Item Description], s.Procode as[Item Code], s.Quantity , um as [UOM], s.sellingprice as [Price 1],s.vndrid as [Supplier],pricea as [Price 2], priceb as [Price 3]  from stock s inner join typediscount t on s.procode=t.proid order by  s.vndrid='" & text1.text & "'"

Open in new window

0
 

Author Comment

by:Whing Dela Cruz
ID: 24835665
Hi! I tried but an error message says " Incorrect syntax near '=',
0
 

Author Comment

by:Whing Dela Cruz
ID: 24835688
When i tried to run it to mssqlserver Query as this

 select s.proname
 as [Item Description], s.Procode as[Item Code], s.Quantity , um
 as [UOM], s.sellingprice
 as [Price 1],s.vndrid
 as [Supplier],pricea
 as [Price 2], priceb
 as [Price 3]  
 from stock s
 inner join typediscount t
 on s.procode=t.proid
 order by  s.vndrid = & "text1.text" & ""
then an error says
 Server: Msg 170, Level 15, State 1, Line 11
Line 11: Incorrect syntax near '='.
Can you correct this error?
Thanks!
0
 
LVL 6

Accepted Solution

by:
microbolt earned 500 total points
ID: 24835690
You have the full error message that you can post here?

Something else that is order by is expecting and column name not an assignment.  What are you trying to accomplish by:

      order by  s.vndrid='" & text1.text & "'"

if your wanting to order by vndrid then it should only be like:

      order by  s.vndrid"
0
 

Author Closing Comment

by:Whing Dela Cruz
ID: 31602618
Hi! You had given me correct answered! Thanks to you and more power..
Can you extend your help to my other posted question? I hope you will...
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

813 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now