473,473 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

results from access into a list box in excel vba

5 New Member
Hi all

Hoping you can help, i'm transferring data from access into to excel.

I want the information to show in a list box, I have got this to work witht he following code:

Public Sub please(ID As Integer)
Dim test As Variant

Set ActiveRecord = SQLQuery("SELECT * FROM ................... WHERE ID= " + Trim(CStr(ID)))
test = ActiveRecord.GetRows
With Me.list
.Clear
.ColumnCount = 6
.list = Application.Transpose(test)
.ListIndex = -1
End With

End Sub

This works fine on its own, except that I need it to look at specifc data and look for all records which correspond to it. code I;m using for this is:

Public Function SearchRecord() As Boolean

Dim NI As String

test= InputBox("...........................", "Search")

If Len(NI) > 0 Then

Dim Query As ADODB.Recordset
Set Query = SQLQuery("SELECT * FROM .... WHERE .......... = '" +....+ "'")

If Not Query.EOF Then

please Query.Fields(".......").Value
SearchRecord = True

Else

MsgBox ".................. " + ......... + " could be located", vbExclamation
SearchRecord = False

End If

Query.Close

Else

SearchRecord = False

End If

End Function

This works fine, however it will only show one record in list box, I need it to show all related records. I have highlighted the section I believe is wrong, but could do with some help to rectify it. I tried to include a loop but that seem to break excel

If Not Query.EOF Then

please Query.Fields("..............").Value
SearchRecord = True
Feb 8 '10 #1
0 1060

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: chrisse_2 | last post by:
Hi, I need some help. I have created a form where there are 3 combo boxes and a text box to search through records. Based on what the user fills in, you then it a "go" button to run the query...
1
by: Suffrinmick | last post by:
Hello Everyone I've built a database using Access 2000 which includes a query which is built using a form containing filters. No problem. When I export the results of the query to excel, (File >...
37
by: jasmith | last post by:
How will Access fair in a year? Two years? .... The new version of Access seems to service non programmers as a wizard interface to quickly create databases via a fancy wizard. Furthermore, why...
1
by: garry.oxnard | last post by:
Can anyone help me to solve a problem which involves switching from Access to Excel (then back to Access) programatically please? I have an Excel template which, on open, also opens an Access...
2
by: Mad Scientist Jr | last post by:
>From an asp.net web page I want the user to open the results of a SQL query in Excel, as automatically as possible (ie not having to loop through columns, rows, in code). For this,...
4
by: ms.wcchan | last post by:
Dearest I.T. professional, I am now doing a survey and would like to ask all customers to submit the questionnaire online so that I can collect the results in the excel file. What programming...
4
by: Belgarath | last post by:
Hello all, I'm a newbie in Access... And before starting to explore this software, I would like to know if it's possible to automate everyday queries result in Excel . If it's possible can...
10
by: dancer | last post by:
How can I save the results of a fill-in form to a Microsoft Excel spreadsheet? I can insert the results into an Access table, but the reports are so tedious to make from Access. Reports are very...
5
ADezii
by: ADezii | last post by:
Periodically, the same or similar question appears in our Access Forum: How can I use Excel Functions within Access? For this reason, I decided to make this Subject TheScripts Tip of the Week. In...
1
Eclipse
by: Eclipse | last post by:
G'day all Can anyone explain the difference in the results to me as I don't understand why specifying the directory name in two different ways could give a different answer. In CODE 1 below i...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.