Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Transpose problem

Hi!

I have userform for extraction of records from .mdb file (using ADO). The
userform contain 1 textbox for entering strings for search, commandbutton for
triggering the search and listbox to show the search results.
the extracted records are presented as multiline instead of one line for
each record.
when I tried to transpose it i got error message about type mismatch (vaData).
I used the following code:
Sub Populate_Combobox_Recordset()
Dim cnt As ADODB.Connection
Dim rst As ADODB.Recordset
Dim stDB As String, stConn As String, stSQL As String
Dim xlCalc As XlCalculation
Dim vaData As Variant
With Application
xlCalc = .Calculation
.Calculation = xlCalculationManual
.EnableEvents = False
.ScreenUpdating = False
End With
Set cnt = New ADODB.Connection
stDB = "C:\Documents and Settings\ELancry\My Documents\chapter6b.mdb"
stConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & stDB & ";"
stSQL = "SELECT * FROM tblContact WHERE LastName Like '%" & TextBox1.Text
& "%'"
With cnt
.CursorLocation = adUseClient 'Necesary for creating disconnected
recordset.
.Open stConn 'Open connection.
Set rst = .Execute(stSQL)
End With
With rst
.MoveFirst 'To retrieve the Recordset.
Set .ActiveConnection = Nothing 'Disconnect the recordset.
vaData = Application.Transpose(.GetRows)
End With

cnt.Close

With UserForm1
With .ListBox1
.Clear
.ColumnCount = 9
.BoundColumn = 1 '(k - 1)
.List = vaData
.ListIndex = -1
End With
End With

With Application
.Calculation = xlCalc
.EnableEvents = True
.ScreenUpdating = True
End With
Set rst = Nothing
Set cnt = Nothing
End Sub

I will be happy to get help to solve this problem

Eli
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in Transpose Hetal Vora[_2_] Excel Discussion (Misc queries) 0 February 9th 09 04:09 PM
Transpose problem Barry Lennox[_2_] Excel Discussion (Misc queries) 4 January 7th 09 07:04 PM
Transpose problem lt[_2_] Excel Programming 2 October 20th 06 09:01 PM
Transpose Problem Biman Excel Discussion (Misc queries) 5 January 13th 05 01:31 PM
Transpose Problem JA Excel Programming 5 June 4th 04 08:57 AM


All times are GMT +1. The time now is 02:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"