473,396 Members | 1,772 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,396 software developers and data experts.

Save As Type Dialog

Hello,

I'm using Access 97 and I would like to save a query but, give the user
the option of the type (e.g. Txt, Xl, Mdb, dbf) etc.

I see this functionality in the Save/Export, Save as type....where one
can select the file format/type.

How can I call this dialog?

I know and have used the "Transfer*" type functions and also the
"Outputto" functions to save as a specific file type. Thats fine!

I would prefer to allow the user to determine whether they want to save
the data as: Excel, Text, Dbf... etc

Alternatively, is it possible to get a recordset into the "Filename"
parameter in the "Open/Save Dialog" API at
http://www.mvps.org/access/api/api0001.htm
Thank you for any help provided.

Nov 13 '05 #1
3 2710
os******@eircom.net wrote:
Hello,

I'm using Access 97 and I would like to save a query but, give the user
the option of the type (e.g. Txt, Xl, Mdb, dbf) etc.

I see this functionality in the Save/Export, Save as type....where one
can select the file format/type.

How can I call this dialog?


It's an API (Application Programmer Interface) that, among others, is
documented on

http://www.mvps.org/access/api/api0001.htm

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #2
I'm OK now... I got it working. I misinterpreted how to use the
ahtCommonFileOpenSave.
Thank you and a Merry Christmas and Happy New Year to all.

Nov 13 '05 #3
Back again with more questions and request for assistance....
Using the "File/Open Dialog API" from
http://www.mvps.org/access/api/api0001.htm, I have created the
following function to allow the user to select either - dbf, xls or
csv(txt) - when exporting data (query or table) to a file.

Function Export_File_Choices()
On Error GoTo Export_File_Choices_Err

Dim strFilter As String
Dim varFileName As String

strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.dbf")
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", "*.xls")
strFilter = ahtAddFilterItem(strFilter, "CSV Files (*.csv)", "*.csv")

varFileName = ahtCommonFileOpenSave( _
OpenFile:=False, _
InitialDir:="F:\", _
Filter:=strFilter, _
FilterIndex:=2, _
DialogTitle:="Save File As...")

Select Case Right(varFileName, 1)
Case Is = "F"
DoCmd.TransferDatabase acExport, "dBase IV", Left(varFileName, 3),
acTable, "tblCarcass", RTrim(Mid(varFileName, 4, 20)), False
Case Is = "S"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97,
"tblCarcass", varFileName, True
Case Is = "V"
DoCmd.TransferText acExportDelim, "Carcass Export Specification",
"tblCarcass", varFileName
End Select

If varFileName = "" Then
MsgBox "No File exported.", vbInformation
Exit Function
End If

Export_File_Choices_Cont:
MsgBox "File exported successfully.", vbInformation
Exit Function

Export_File_Choices_Err:
Select Case Err
'Handle a specific error here
Case 1
MsgBox "Error has occurred"
'Any other error
Case Else
MsgBox Err.Description, vbCritical
End Select

Resume Export_File_Choices_Cont

End Function
What I would appreciate very much is:

1. If someone can improve it for me
2. If someone could suggest how to make the function "Generic" i.e. if
the table name could be passed as a variable from a call
3. If someone could suggest how to incorporate a "DAO Recordset" for
example when typically used with writing to a file using "Print # or
Write #"

Apologies for any word wrap. Thanks for any suggestions and
solutions....

osmethod

Nov 13 '05 #4

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

Similar topics

4
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download"...
4
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. ...
0
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they...
1
by: M Pearson | last post by:
Hello there all, am very new to asp.net programming and am struggling with this problem. What I trying to achieve. On a button click I want the standard web save as dialog to display. The user...
6
by: Mike | last post by:
can i open the save file dialog box from a asp.net web page? thx
3
by: =?Utf-8?B?YXNkZg==?= | last post by:
Hello. I am making a web application with c# and am using this code: Response.ContentType = "application/x-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=" +...
2
by: vbaDev | last post by:
Hi. I am using Access 2000 and in my code I'm exporting a table into an Excel file (creating it), then the code needs to export another query into the same file (a new worksheet). So I needed both a...
1
by: rn5a | last post by:
When users submit a Form with a SQL query, the resultset is retrieved from a MS-Access database table which is then exported to an MS-Excel worksheet. After the records get exported to MS-Excel, I...
0
by: ppardi | last post by:
I'm developing an addin for Word 2007 and I need to determine whether a user saves a Word 2007 document in an older format (97-2003) after a save as is done. The scenario is that the user starts...
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:
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...
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
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,...
0
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...

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.