Advertisement

05.07.2007 at 07:40PM PDT, ID: 22558244
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

VBA/Excel SQL Query

Asked by SaxonNZ in SQL Query Syntax, VB Database Programming

Tags: , , ,

Hi all :)

Just a quick VBA/Excel Question. I'm fairly new to VBA.

I'm currently trying to query an informix database, where as the user would put the specific date range they require in two textboxes, i,e '1/5/2007' '31/5/2007'. Then they would hit the refresh button and the query would use the values they just entered.

My main problem so far is getting the correct syntax for the SQL query to use the values in the textboxes. The particular piece of code  in question follows.

Public Sub HaweraSales()

    Dim obj As Object
    Dim rec As ADODB.Recordset
    Set obj = CreateObject("ADODB.Connection")
   
    obj.Open "dsn=p615;"
   
    obj.BeginTrans
    obj.Execute ("select spddate, sphprodno, sum(spdvalue) sales, sum(spdgrossprofit) profit from salesbyperiod where sphwhseno = " & Chr(34) & "HWF" & Chr(34) & " and sphdepartment = " & Chr(34) & "50" & Chr(34) & " and spddate >=" & Chr(34) & Me.txtDate & Chr(34) & "  and spddate <='" & Chr(34) & Me.txtDate1 & Chr(34) & " group by 1,2 into temp a1 with no log")

  obj.CommitTrans

Me.txtDate and Me.txtDate1 being the text boxes in question. It gives me an error saying - Compile Error - Invalid use of Me Keyword. I understand that Me cant be used in modules?

Any possible alternative syntax that does the same thing? I hope this makes sense.

Thanks in advance for any possible help anyone can give.



Start Free Trial
[+][-]05.07.2007 at 11:38PM PDT, ID: 19047937

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Query Syntax, VB Database Programming
Tags: excel, vba, sql, query
Sign Up Now!
Solution Provided By: pkwan
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.08.2007 at 12:46AM PDT, ID: 19048100

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2007 at 01:04AM PDT, ID: 19048177

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2007 at 03:48AM PDT, ID: 19048749

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.08.2007 at 01:16PM PDT, ID: 19052734

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2007 at 02:18PM PDT, ID: 19053132

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32