473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Export with a list box

158 100+
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 2371
ADezii
8,834 Expert 8TB
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
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.