Solved

adodc1

Posted on 2009-07-12
5
276 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

708 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

12 Experts available now in Live!

Get 1:1 Help Now