473,387 Members | 1,575 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.

exporting data to excel

Dear Gurus

I am trying to export some data to excel from a form, but I seem to run into
difficulties when the user has filtered for particular data that is from a
dropdown (linking to another table in a one to many relationship).

The W (filter for the form) that caused the error was

WHERE ((([Lookup_M-CIT-ID].DD="New York"))) AND (([Lookup_M-CLI-ID].DD="X"))

so from the form the user had filtered for a lookup ("M-CIT-ID") that should
be equal to New York and another field ("M-CLI-ID") that should be equal to
X

in my excel output I want to also have all the records from the form where
the M-CIT-ID field is equal to the ID for New York and the M-CLI-ID is equal
to the ID for X.
Here is my code:

Public Function s151()
'on error GoTo ERR
'---
Dim FilN As String 'file name
Dim MSG As String
Dim SQLs As String
Const TempTbl = "ZOUTPUTtbl"
Dim RST As dao.Recordset
Dim W As String
'---
Set RST = FRM.RecordsetClone
If FRM.FilterOn = True Then
W = " WHERE " & FRM.FILTER
If W = " WHERE " Then W = ""
End If
SQLs = "SELECT [" & RST.Name & "].* INTO [" & TempTbl & "] FROM [" &
RST.Name & "] " & W & ";"
FRUNSQL (SQLs)
FilN = Format(FRM.Caption & Format(TIME() * 24 * 60 * 60, "0000") &
".xls", "<")
MSG = FINTXT(240) & FilN
'---
Call FMB(-10, MSG)
DoCmd.OutputTo acOutputTable, TempTbl, acFormatXLS, FilN, True, ""
xit:
Exit Function
ERR:
MsgBox ERROR$ & " {PROCEDURE # " & oPt + ModEro & "}"
Call Ferr
Nov 13 '05 #1
0 1236

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
3
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works...
4
by: D | last post by:
I've created a report with many subreports of aggregate data. I want my client to be able to export this data to Excel to make her charts, etc. Only one problem: one of the fields is a "SchoolYear"...
2
by: G | last post by:
When I export data from access to excel by with "export" or "Analyze with" I seem to loose parts of some fields (long text strings). Is there a way to export it all to excel? Thanks G
2
by: pmud | last post by:
Hi, I am exporting data from an EDITABLE DATA GRID EXCEL. But the 1st column in data grid is Edit Column. I want to display all columns in Excel except for the Edit column. The following...
2
by: bienwell | last post by:
Hi, I have a question about exporting data from datagrid control into Excel file in ASP.NET. On my Web page, I have a linkbutton "Export data". This link will call a Sub Function to perform...
21
by: bobh | last post by:
Hi All, In Access97 I have a table that's greater than 65k records and I'm looking for a VBA way to export the records to Excel. Anyone have vba code to export from access to excel and have the...
2
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
1
by: 333sridhar333 | last post by:
Hi, I am having a problem in exporting a data from jsp to excel. I am getting the values from a servlet and populating it to a JSP. And form there i export them to Excel. The functionality...
2
by: 333sridhar333 | last post by:
Hi, I am having a problem in exporting a data from jsp to excel. I am getting the values from a servlet and populating it to a JSP. And form there i export them to Excel. The functionality...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.