Solved

String SQL

Posted on 2000-05-14
7
159 Views
Last Modified: 2010-05-02

Please, what is wrong with this string:

strMA = tmes.Text
strM = Left(strMA, InStr(1, trMA, "/") - 1)

strA = Mid(strMA, InStr(1, strMA, "/") + 1)

cod = txtcodi.Text

strSQL = "SELECT DISTINCTROW Estag.Name, VD.History,"
strSQL = strSQL & " Pag.CodVenc, Pag.Val, Pag.CodEstag, Pag.MesAno,"

strSQL = strSQL & " FROM VD INNER JOIN (Estag INNER JOIN Pag ON Estag.CodEstag = Pag.CodEstag)"

strSQL = strSQL & " ON VD.CodVenc = Pag.CodVenc"

strSQL = strSQL & " WHERE Pag.CodEstag =" & cod

strSQL = strSQL & " AND Month(MA) = " & strM & " AND Year(MA) = " & strA
strSQL = strSQL & " ORDER BY Nome"
   
Data2.RecordSource = strSQL
Data2.Refresh
0
Comment
Question by:JorgeLuis
7 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 10 total points
ID: 2808768
You've got an extra comma after Pag.MesAno...

For *5* points that more help than your post deserves!

M
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2808815
be careful mark...first question he asked here I gave a perfectly good answer and got a big fat 'C' for it. i dont get it, people come here to ask questions b/c they obviously couldnt figure it out on their own...and then upon getting a solution, they have the nerve to be critical about the working solution they received?  i think this is a possible topic for another one of your lounge discussions  =)
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2809096
Some folx don't read the fine print (or english isn't their first language) and they don't understand it doesn't cost anything to give an 'A'. But *5* points without a claim of "poverty" is just plain *cheap*!

I think you're right, that might make a good lounge Q! :-)

M
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 15

Expert Comment

by:StingRaY
ID: 2809643
8-)
Hi mark , Hi AzraSound....<-- Just say Hi to you two... 8-)

JorgeLuis.

ORDER BY Nome <--??
or ORDER BY Name ???

5 points??...
ho ho ho
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2810362
StingRaY, most of the fields looked "foreign". I let the oddball spellings slide... :-)

M
0
 
LVL 1

Expert Comment

by:jjsc
ID: 2811437
From the name (JorgeLuis) and the names of the DB fields used, I would say the language is Portuguese. In that case the statement "ORDER BY Nome" is valid (Nome is Portuguese for Name :-)

As for the rest (points etc.) no comment :-)

0
 

Author Comment

by:JorgeLuis
ID: 2812726
Adjusted points from 5 to 10
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

825 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