473,511 Members | 15,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export with a list box

158 New Member
I'm trying to figure out how to export based on a list box. here is the code that i have, and for some reason its not working.

Expand|Select|Wrap|Line Numbers
  1. If (lstExport.Selected(1) = vbTrue) Then
  2.     DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "tblSaveMVROutlets", "C:\Maps_MVRs\Append_Work_Files\Analysis\MVRs_Outlets_Export.xls", True
  3.     MsgBox "Exported", vbOKOnly
  4.     End If
  5. End Sub
Any help would be greatly appreciated
Aug 19 '08 #1
1 2378
ADezii
8,834 Recognized Expert Expert
To efficiently process Selected Items in a List Box, use this code as a Template:
Expand|Select|Wrap|Line Numbers
  1. Dim varItem As Variant
  2.  
  3. With Me![lstExport]
  4.   'Make sure at leats 1 Item is selected
  5.   If .ItemsSelected.Count > 0 Then
  6.     For Each varItem In .ItemsSelected
  7.       'Process entry in the Bound Column
  8.       Debug.Print .Column(0, varItem)
  9.     Next
  10.   Else
  11.     Exit Sub
  12.   End If
  13. End With
Aug 20 '08 #2

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

Similar topics

205
10458
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
1
4127
by: Danny | last post by:
Is there a way to use the DoCmd.TransferText to export a database to a text file but with leaving a field out? I need the ID field to do one sort before I export. the spec does not let me...
3
3972
by: Iavor Raytchev | last post by:
Hello, We a situation with a central database that contains the data that needs to be presented at N off-line terminals (N can be 5 000 can be 15 000). Each terminal presents unique data. The...
7
3816
by: mattc66 via AccessMonster.com | last post by:
I need to create an EDI 850 Record Set. The EDI 850 Record set I am creating consists of 2-5 seperate tables all linked by the CustomerID and CustomerPO. Tables - tblOrder - >Link CustomerID...
0
1375
by: exportación de ficheros excel a XML | last post by:
I have a problem when I try to export an excel document to xml format in excel, I have a list that is repeated many times and inside of this list exist another lists that repeated continually too....
5
37181
by: RadhakrishnanR | last post by:
Hi, By using VB6.0, I want to export database table data into (i.e based on the selected file type(xls or txt)) excel file or text file with a tab delimited text file. My User interface has: ...
2
20271
by: RadhakrishnanR | last post by:
Hi, By using VB6.0, I want to export database table data into text file with a tab delimiter. My User interface has: • Drop down list box contain list of data base table name. • A path...
17
7190
by: Fabry | last post by:
Hi All, I'm new of this group and I do not know if this is the correct group for my question. I have a DLL with its export library (.lib) wrote in Borland C++ 6. In borland everything is OK and...
1
9755
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm...
1
2422
by: SysProg | last post by:
I need some help with a problem I've encountered. I am a zLinux, WAS, and DB2 noob so please bear with me. I am helping to support two WebSphere applications which utilize DB2 under zLinux. One...
0
7138
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
7353
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5662
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
5063
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
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
446
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.