Advertisement

05.08.2007 at 02:28PM PDT, ID: 22560244
[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!

8.2

VBA - User Type not defined

Asked by SaxonNZ in Visual Basic Programming

Tags: , ,

Hi, i am currently working with VBA in Excel. Run into a bit of a problem though.

I am getting this error: User defined type not defined.  However, Even after i have set the reference to Microsoft ActiveX Data Objects 2.8 Library.  

The break is on this line.

Public Sub HaweraSales(objForm As Form)

I'll paste all my code below:

Public Sub HaweraSales(objForm As Form)

    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) & objForm.txtDate & Chr(34) & "  and spddate <='" & Chr(34) & objForm.txtDate1 & Chr(34) & " group by 1,2 into temp a1 with no log")
    obj.Execute ("select (spddate) fdate, sum(sales) fsales, sum(profit) fprofit from a1 group by 1 into temp a2 with no log")
    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 >='" & objForm.txtDate & Chr(34) & "  and spddate <='" & objForm.txtDate1 & Chr(34) & " group by 1,2 into temp b1 with no log")
    obj.Execute ("select (spddate) mdate, sum(sales) msales, sum(profit) mprofit from b1 group by 1 into temp b2 with no log")
    obj.Execute ("select ohorddmy, count(ohintref) invcount from ohhist where ohwhse = " & Chr(34) & "HWF" & Chr(34) & "   and ohorddmy >='" & objForm.txtDate & Chr(34) & "  and ohorddmy <='" & objForm.txtDate1 & Chr(34) & " group by 1 into temp c1 with no log")
   
   obj.CommitTrans
 
   
    Set rec = New ADODB.Recordset
    rec.ActiveConnection = obj
    rec.Source = "select unique spddate, fsales, fprofit, msales, mprofit, invcount from salesbyperiod, outer a2, outer b2, outer c1 where spddate = fdate   and spddate = mdate   and spddate = ohorddmy   and spddate >= " & Chr(34) & objForm.txtDate & Chr(34) & "  and spddate <= " & Chr(34) & objForm.txtDate1 & Chr(34) & "  order by 1"
    rec.CursorType = 0
    rec.CursorLocation = 2
    rec.LockType = 1
    rec.Open
   
        'Get the worksheet

    Workbooks("Hawera Daily Sales Comparison May 07.xls").Worksheets("sheet2").Activate
    'Fill in the headers
    For Count = 1 To rec.Fields.Count
        Workbooks("Hawera Daily Sales Comparison May 07.xls").Worksheets("sheet2").Cells(2, Count).Value = rec.Fields.Item(Count - 1).Name
    Next
   
    Dim current_row
    current_row = 3
    rec.MoveFirst
     Do
        For Count = 1 To rec.Fields.Count
        Workbooks("Hawera Daily Sales Comparison May 07.xls").Worksheets("sheet2").Cells(current_row, Count).Value = rec.Fields.Item(Count - 1).Value
        Next
        rec.MoveNext
        current_row = current_row + 1
     Loop While Not rec.EOF
     Sheets("sheet1").Select
End Sub

Thanks in advance.Start Free Trial
[+][-]05.08.2007 at 02:39PM PDT, ID: 19053253

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]05.08.2007 at 02:42PM PDT, ID: 19053275

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]05.08.2007 at 02:55PM PDT, ID: 19053330

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:06PM PDT, ID: 19053379

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]05.08.2007 at 03:36PM PDT, ID: 19053529

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:41PM PDT, ID: 19053555

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]05.08.2007 at 03:56PM PDT, ID: 19053622

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 04:02PM PDT, ID: 19053646

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]05.08.2007 at 04:09PM PDT, ID: 19053677

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]05.08.2007 at 04:31PM PDT, ID: 19053786

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

Zone: Visual Basic Programming
Tags: type, defined, vba
Sign Up Now!
Solution Provided By: GrahamSkan
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.08.2007 at 04:52PM PDT, ID: 19053884

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 07:48PM PDT, ID: 19054385

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