[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[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!

9.0

RUNTIME ERROR 13 :  TYPE MISMATCH ???

Asked by fordraiders in Visual Basic Programming

Tags: error, 13, type, mismatch, runtime

VB6 SP4
WIN 2000
EXCEL 2000
ACCESS 2000

I keep getting an error on the line below. as indicated.
I HAVE TRIED CHANGING THE STRINGS TO VARIANTS BUT IT DOES NOT HELP....

I'm trying to import(map)  data from Access to Excel via listbox field selections.
This field go to that column  etc.............


'  ACCESS TO EXCEL

' reopen access
Dim statement As String
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim db_name As String
Dim Copycells As Variant
'db_name = Text2.Text
db_name = Text1.Text
    ' Open a connection.
    Set conn = New ADODB.Connection
    conn.ConnectionString = _
        "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=" & db_name & ";" & _
        "Persist Security Info=False"
    conn.Open
Set rs = New ADODB.Recordset
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic


' ==============      reopen excel   Destiniation     =============================
'EFile = CommonDialog1.FileName
   Text2.Text = EFile ' efile is a variable
     Set oDest = CreateObject("Excel.Application")
       oDest.Visible = True
         oDest.workbooks.Open EFile
' ==============      reopen excel        =============================
rs.Open (List1), conn, , , adCmdTable ' all records

        Dim lastSourceRow As Long
         Dim lastDestRow As Long
   
         lastSourceRow = rs.RecordCount    'oSource.SHeets(List1.Text).UsedRange.Rows.Count
         lastDestRow = oDest.SHeets(List4.Text).UsedRange.Rows.Count
 '        ReDim Copycells(lastSourceRow - 1) As Variant
'        oDest.Visible = True
' NEW CODE **********************************************************
'Dim CopyText As String
Dim CopyText As Variant
Dim str1 As String
Dim sourcedest As String
Dim x2 As Variant
'Dim strUnknown As String
'Dim strNext As String
' start Excel to Access import

Do While Not rs.EOF
x2 = lastDestRow + 1
lastDestRow = x2
  oDest.ActiveCell.Offset(1, 0).Range("A1").Select
 oDest.ActiveCell.EntireRow.Insert
   For x = 1 To lvwMap.ListItems.Count
            str1 = lvwMap.ListItems.Item(x).ListSubItems(1).Text
           sourcedest = lvwMap.ListItems.Item(x).ListSubItems(3).Text
    CopyText = rs.Fields(str1).Value
' ERROR ON THE LINE BELOW  RUNTIME ERROR 13 TYPE MISMATCH
    oDest.SHeets(List4.Text).Range(oDest.workbooks(1).SHeets(List4.Text).Cells(x2, CInt(sourcedest)), oDest.workbooks(1).SHeets(List4.Text).Cells((x2), CInt(sourcedest))).Value = CopyText
   Next x
   x2 = x2 + 1
      rs.MoveNext
         Loop
   rs.Close
   conn.Close

' NEW CODE **********************************************************
        MsgBox "Acces Data Import is Completed !"


[+][-]02/25/04 03:08 PM, ID: 10455154Accepted Solution

View this solution now by starting your 30-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: error, 13, type, mismatch, runtime
Sign Up Now!
Solution Provided By: Ark
Participating Experts: 4
Solution Grade: A
 
[+][-]02/25/04 11:43 AM, ID: 10453529Assisted Solution

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

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

 
[+][-]02/25/04 11:43 AM, ID: 10453537Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/25/04 11:46 AM, ID: 10453561Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/25/04 11:47 AM, ID: 10453568Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/25/04 11:55 AM, ID: 10453638Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/25/04 12:03 PM, ID: 10453710Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/25/04 12:08 PM, ID: 10453743Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/25/04 12:17 PM, ID: 10453816Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/25/04 01:33 PM, ID: 10454472Assisted Solution

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

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

 
 
Loading Advertisement...
20091118-EE-VQP-93