Modules & VBA :: Save As Dialog Box - Allow User To Save Copy Of Current Database At Desired Location
Feb 12, 2014
So I have this relatively simple problem: I need to create a button that once clicked will open the Save As dialog box and allow the user to save a copy of the current database where he wishes. The filename should contain todays date in DDMM format along with some pre-set text e.g. DDMM PresetText.
I am using Access 2010.
View Replies
ADVERTISEMENT
Dec 6, 2013
Access 2010:
The database I'm working on stores label images, or better stated, it stores file paths where the label images are stored. These paths are used in reports and forms to view the label images within the database. What I'd like to do is to create a "save" or "email" button that will allow the user to select a location to save just a copy of the image in jpg format. I realize that it is possible to imbed the jpg image into a report and export it as a pdf. What I'd really like to do is find a way to save the image (perhaps by copying it from the path in the database and simply relocating it) and preserve the jpg extension if that is possible.
I am also aware that there are third party applications that will convert pdf reports into jpg files however network restrictions keep me pretty limited in my ability to download third party software.
View 2 Replies
View Related
May 7, 2015
The code below sets my printer to "Cute PDF writer" and then opens a report in print view, which creates a PDF version of my report. So far so good. But just before the last step, it brings up the Save As dialog box, asking for a filename and location.
Three points are important:I always want to call the PDF document "Specialty Report".I always want to save it to C:Documents and Settings80435 Desktop. I always want to overwrite the previous version.
Is there some code I can insert that would achieve this automatically with no further user interaction i.e. user clicks a button and the PDF file is created/overwritten?
Code:
'Produce the report
Dim defPrinter As String, NewPrinter As Printer
defPrinter = Application.Printer.DeviceName 'Get the default printer name
Set NewPrinter = Application.Printers("CutePDF Writer") 'Create a new printer object
Set Application.Printer = NewPrinter 'Set the default printer to the new printer
DoCmd.OpenReport "Specialty Report", acViewPrint 'Open the report in print view (which will PDF it)
Set NewPrinter = Application.Printers(defPrinter) 'Reset the printer back to the default printer
View 3 Replies
View Related
Aug 8, 2013
I need code for save dialog file ,and select the file from textbox and save it to the selected location.i have only this code and i dont know what else i can do with this because it just opens the save file dialog !
View 1 Replies
View Related
Oct 16, 2014
I wish to export a report to excel, but I wish to prompt the user to be able to choose where to save the file at. How can I have the "Save As" dialog box pop up, with the filter set to "*.xls"?
View 2 Replies
View Related
Mar 4, 2014
How I can save a Query result with a desired name. I use the following simple code.
Code:
SELECT * INTO Table
FROM Query;
Now the results will be saved in "Table" but I want acces to ask me for what to call the table when the query is runned. Is that possible with a query?
View 1 Replies
View Related
Mar 17, 2014
I have a question that I have a Microsoft Access database (.accdb) front-end/backend split and I want to give the database to my company client. As we have the different path for the backend/frontend linked. I want some code that will popup if the database location is not found and popup with the dialog so the user then select the backend and it would be ready and there is no need to popup each time the database open, it would run once it did not find the last linked path.
Also I have tried the code of Dev Ashish URL.... but unfortunately it would ask everytime to refresh the table links and I only want to run the process of linking tables when the database start and the linked path not found.
View 1 Replies
View Related
Jan 17, 2014
I'm using: DoCmd.OutputTo acOutputForm, "Frm_EL_PL_Bulk_Send", acFormatPDF, outputFileName1...To save a form as a PDF. The issue is, it saves all the records in that set in continuous form, and I'm trying to get it to only save the record its on.
View 3 Replies
View Related
Jan 10, 2014
I have a few selected reports on an Access 2007 database that users can run. Is there a way for users to view the report, save as a PDF and automatically save a copy to a shared drive by modules/vba coding as an On Click event procedure?
View 4 Replies
View Related
May 25, 2014
I'm looking to add a button to my Customers form which will mailmerge the current record to a Word template and then save the Word doc as a new file (Ideally the customer's name).
I've looked at the Super Easy Mailmerge but I can't work out how to implement it without all of the variables (selecting documents etc.).
The files will all be saved to one location (C:CustomersExports) and this won't change.
This is also the location of the mailmerge template (C:CustomersExportsTemplate.docx)
View 9 Replies
View Related
Mar 11, 2005
Hi everyone,
I have a client I'm currently working for that has dumped Access on me. I'm not originally here for Access and am sort of learning as I go along (I'm here to setup, run, and maintain servers, etc.)
The problem is they have a large contact database in Access, and want the forms to pop up a dialog asking if data changes are okay before actually updating. I know that Access normally just does the change, but there is an issue with someone that doesn't understand computers at all making a mess of it (adding in one client 15 times, each with one different piece of information, erasing things in an attempt to search, etc, etc.)
I've been going all over the place trying to research the issue for hours and have had no luck finding a solution. Any help would be beyond appreciated. Thanks in advance for any help!
-Walter
View 8 Replies
View Related
Dec 4, 2013
I have 2 form, form1 and form 2 (picture attached)
In Form 1
(main form) there are "reference" field with key pressed event
then call form 2 (list of reference that user can choose)
In form 2
the problem is, when "enter" key pressed (keypress event), selection will move to next record
so the data that transferred to form 1 is wrong (next record)
The question is : how to save current record in form 2 before enter and send the data to form 1
View 3 Replies
View Related
Jul 16, 2007
I have a problem. This problem is that when I generate the report, I want to show a save file dialog box. How can I do this and and retrict the files show to only "*.pdf" files. I tried it as follow:
Private Sub SaveFile_Click()
Set FDialog = Application.FileDialog(msoFileDialogSaveAs)
With FDialog
.Filters.Add "Acrobat Files", "*.pdf" .Show
End With
End Sub
error is araised when executing .Filters.Add "Acrobat Files", "*.pdf": Object doesnt support property or method.
ALSO How can I pick the path the user selected?
Thanks
View 1 Replies
View Related
Jul 18, 2005
Hi every body . I found this code that supposed to allow me browse for .mdb file
and select it. But unfortunely i could not set it up. could an expert help me set this up
in access 2000. Furthermore how i can refrence the loaded .mdb file when ever i want to use
it instead of current db in vba.Thanks
Code:***************** Code Start **************'This code was originally written by Ken Getz.'It is not to be altered or distributed,'except as part of an application.'You are free to use it in any application,'provided the copyright notice is left unchanged.'' Code courtesy of:' Microsoft Access 95 How-To' Ken Getz and Paul Litwin' Waite Group Press, 1996Type tagOPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long strFilter As String strCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long strFile As String nMaxFile As Long strFileTitle As String nMaxFileTitle As Long strInitialDir As String strTitle As String Flags As Long nFileOffset As Integer nFileExtension As Integer strDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As StringEnd TypeDeclare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _ Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As BooleanDeclare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _ Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As BooleanDeclare Function CommDlgExtendedError Lib "comdlg32.dll" () As LongGlobal Const ahtOFN_READONLY = &H1Global Const ahtOFN_OVERWRITEPROMPT = &H2Global Const ahtOFN_HIDEREADONLY = &H4Global Const ahtOFN_NOCHANGEDIR = &H8Global Const ahtOFN_SHOWHELP = &H10' You won't use these.'Global Const ahtOFN_ENABLEHOOK = &H20'Global Const ahtOFN_ENABLETEMPLATE = &H40'Global Const ahtOFN_ENABLETEMPLATEHANDLE = &H80Global Const ahtOFN_NOVALIDATE = &H100Global Const ahtOFN_ALLOWMULTISELECT = &H200Global Const ahtOFN_EXTENSIONDIFFERENT = &H400Global Const ahtOFN_PATHMUSTEXIST = &H800Global Const ahtOFN_FILEMUSTEXIST = &H1000Global Const ahtOFN_CREATEPROMPT = &H2000Global Const ahtOFN_SHAREAWARE = &H4000Global Const ahtOFN_NOREADONLYRETURN = &H8000Global Const ahtOFN_NOTESTFILECREATE = &H10000Global Const ahtOFN_NONETWORKBUTTON = &H20000Global Const ahtOFN_NOLONGNAMES = &H40000' New for Windows 95Global Const ahtOFN_EXPLORER = &H80000Global Const ahtOFN_NODEREFERENCELINKS = &H100000Global Const ahtOFN_LONGNAMES = &H200000Function TestIt() Dim strFilter As String Dim lngFlags As Long strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)", _ "*.MDA;*.MDB") strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF") strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT") strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*") MsgBox "You selected: " & ahtCommonFileOpenSave(InitialDir:="C:", _ Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _ DialogTitle:="Hello! Open Me!") ' Since you passed in a variable for lngFlags, ' the function places the output flags value in the variable. Debug.Print Hex(lngFlags)End FunctionFunction GetOpenFile(Optional varDirectory As Variant, _ Optional varTitleForDialog As Variant) As Variant' Here's an example that gets an Access database name.Dim strFilter As StringDim lngFlags As LongDim varFileName As Variant' Specify that the chosen file must already exist,' don't change directories when you're done' Also, don't bother displaying' the read-only box. It'll only confuse people. lngFlags = ahtOFN_FILEMUSTEXIST Or _ ahtOFN_HIDEREADONLY Or ahtOFN_NOCHANGEDIR If IsMissing(varDirectory) Then varDirectory = "" End If If IsMissing(varTitleForDialog) Then varTitleForDialog = "" End If ' Define the filter string and allocate space in the "c" ' string Duplicate this line with changes as necessary for ' more file templates. strFilter = ahtAddFilterItem(strFilter, _ "Access (*.mdb)", "*.MDB;*.MDA") ' Now actually call to get the file name. varFileName = ahtCommonFileOpenSave( _ OpenFile:=True, _ InitialDir:=varDirectory, _ Filter:=strFilter, _ Flags:=lngFlags, _ DialogTitle:=varTitleForDialog) If Not IsNull(varFileName) Then varFileName = TrimNull(varFileName) End If GetOpenFile = varFileNameEnd FunctionFunction ahtCommonFileOpenSave( _ Optional ByRef Flags As Variant, _ Optional ByVal InitialDir As Variant, _ Optional ByVal Filter As Variant, _ Optional ByVal FilterIndex As Variant, _ Optional ByVal DefaultExt As Variant, _ Optional ByVal FileName As Variant, _ Optional ByVal DialogTitle As Variant, _ Optional ByVal hwnd As Variant, _ Optional ByVal OpenFile As Variant) As Variant' This is the entry point you'll use to call the common' file open/save dialog. The parameters are listed' below, and all are optional.'' In:' Flags: one or more of the ahtOFN_* constants, OR'd together.' InitialDir: the directory in which to first look' Filter: a set of file filters, set up by calling' AddFilterItem. See examples.' FilterIndex: 1-based integer indicating which filter' set to use, by default (1 if unspecified)' DefaultExt: Extension to use if the user doesn't enter one.' Only useful on file saves.' FileName: Default value for the file name text box.' DialogTitle: Title for the dialog.' hWnd: parent window handle' OpenFile: Boolean(True=Open File/False=Save As)' Out:' Return Value: Either Null or the selected filenameDim OFN As tagOPENFILENAMEDim strFileName As StringDim strFileTitle As StringDim fResult As Boolean ' Give the dialog a caption title. If IsMissing(InitialDir) Then InitialDir = CurDir If IsMissing(Filter) Then Filter = "" If IsMissing(FilterIndex) Then FilterIndex = 1 If IsMissing(Flags) Then Flags = 0& If IsMissing(DefaultExt) Then DefaultExt = "" If IsMissing(FileName) Then FileName = "" If IsMissing(DialogTitle) Then DialogTitle = "" If IsMissing(hwnd) Then hwnd = Application.hWndAccessApp If IsMissing(OpenFile) Then OpenFile = True ' Allocate string space for the returned strings. strFileName = Left(FileName & String(256, 0), 256) strFileTitle = String(256, 0) ' Set up the data structure before you call the function With OFN .lStructSize = Len(OFN) .hwndOwner = hwnd .strFilter = Filter .nFilterIndex = FilterIndex .strFile = strFileName .nMaxFile = Len(strFileName) .strFileTitle = strFileTitle .nMaxFileTitle = Len(strFileTitle) .strTitle = DialogTitle .Flags = Flags .strDefExt = DefaultExt .strInitialDir = InitialDir ' Didn't think most people would want to deal with ' these options. .hInstance = 0 '.strCustomFilter = "" '.nMaxCustFilter = 0 .lpfnHook = 0 'New for NT 4.0 .strCustomFilter = String(255, 0) .nMaxCustFilter = 255 End With ' This will pass the desired data structure to the ' Windows API, which will in turn it uses to display ' the Open/Save As Dialog. If OpenFile Then fResult = aht_apiGetOpenFileName(OFN) Else fResult = aht_apiGetSaveFileName(OFN) End If ' The function call filled in the strFileTitle member ' of the structure. You'll have to write special code ' to retrieve that if you're interested. If fResult Then ' You might care to check the Flags member of the ' structure to get information about the chosen file. ' In this example, if you bothered to pass in a ' value for Flags, we'll fill it in with the outgoing ' Flags value. If Not IsMissing(Flags) Then Flags = OFN.Flags ahtCommonFileOpenSave = TrimNull(OFN.strFile) Else ahtCommonFileOpenSave = vbNullString End IfEnd FunctionFunction ahtAddFilterItem(strFilter As String, _ strDescription As String, Optional varItem As Variant) As String' Tack a new chunk onto the file filter.' That is, take the old value, stick onto it the description,' (like "Databases"), a null character, the skeleton' (like "*.mdb;*.mda") and a final null character. If IsMissing(varItem) Then varItem = "*.*" ahtAddFilterItem = strFilter & _ strDescription & vbNullChar & _ varItem & vbNullCharEnd FunctionPrivate Function TrimNull(ByVal strItem As String) As StringDim intPos As Integer intPos = InStr(strItem, vbNullChar) If intPos > 0 Then TrimNull = Left(strItem, intPos - 1) Else TrimNull = strItem End IfEnd Function'************** Code End *****************
View 5 Replies
View Related
Nov 21, 2014
I have a form with multiple textboxes and comboboxes that allow for user entry, and a subform displaying a table, where the entries from the form are saved and can be retrieved. It's basically a way of creating new task entries and editing existing ones from a single interface.
One of the fields is an "issue number" of sorts, which is a 5-digit code that identifies the task. We have a website where details of each task are stored, and the URL format is akin to this: [URL] ....
The functionality that I'm hoping for is that when the user saves the record, it will be saved as the full link address, by concatenating the static first portion of the address and the code entered by the user. However, I need the table to still only display the code, not the whole link address, and will follow the full address when clicked in the subform table.
View 2 Replies
View Related
Feb 23, 2014
I find the following CODE online (Print to PDF). Which work perfectly for me, the only issue and/or modification I am looking for "Popup Window to save the file at any location", instead at fixed location.
Option Compare Database
Option Explicit
Function PrintToPDF(SrcFile As String)
On Error GoTo PrintToPDF_Err
'Function can be called from any report with this: "PrintToPDF(Screen.ActiveForm.Name)"
[Code] ....
View 1 Replies
View Related
Oct 21, 2013
here's the scenario
table1:
Name text
age numbers
sex text
date date
box1 text
now when i create form i want the "box1" change color when i triggered 1st click it turns blue then 2nd click it turns red then 3rd click white the it repeat the cycle.and after i choose a color i want to save it. along with my records.
how can i do this?
[URL]
View 11 Replies
View Related
Oct 27, 2014
I have a back end database that a number of people are working with using an Excel add-in that imports and edits records saved in the backend. Occasionally, when a user will update a record at first it saves to the backend but then an hour or two later, the changes made disappear. We have validated that after the user saves the changes, those changes are present in the backend of the database, but for some reason those changes disappear after a period of time.
View 7 Replies
View Related
Sep 4, 2012
I have a folder with Access files, subfolders, and some .vbs files in it. It requires one person to navigate through a setup process. Once the setup is completed, they need to copy the folder and its contents to a location on a shared drive, which is unknown to me and will be chosen by the user at the site. There could be many sites.
It basically works like this:
Files are downloaded to C:Program Files.
A vbscript is run and extracts a folder directly to the C:Drive and opens it. I'll call it C:Test.
The user manually moves the BE file to a shared drive.
The user opens the FE file and is walked through using the Linked Table Manager.
The user then follows a series of forms to input data.
After this, the FE closes and another DB opens.
The second DB walks them through the Linked Table Manager and closes.
Option #1 At this point I would like to have a script and have it copy that folder, C:Test, and its contents, and have a dialog box open telling the user to paste it in a location where all users have access to.
Option #2 A script that will backup the folder and all its contents to a shared location selected by the user.
Either option will l allow others to navigate to that location, copy the folder, and paste the folder to their C: Drive.
View 2 Replies
View Related
Sep 2, 2013
I have encountered several times, and now, that after using any "cut and paste" or "copy and paste" on VBA code in the event sub, even for a few words, Access does not allow me to exit when I answer 'Yes' to save the changes. It forces me to respond "No" to exit and re-enter any changes again without using copy or cut and paste.
This is very troublesome and error-prone in program development that the program statements cannot be moved or copies to another location of the program module.
I have over 30 TextBoxes and ComboBoxes on the form and about 20 pages of program code, using Access 2010 (same situation for Access 2013) on Windows7 PC with 4GB of RAM.
View 4 Replies
View Related
Aug 27, 2006
I have a basic data entry form which is called frmPeople which has the following
First Name
Last Name
Address
City
State
Zip
What i want to do is if user changes/edits any of the information will prompt user do you wish to save changes yes/no
If user clicks yes will save info
if user clicks no will restore original info
View 4 Replies
View Related
Oct 11, 2007
I have a Contacts form which has a Calls sub-form which itself has a Subjects sub-form. From the Contacts form the user can click a button which writes a pro-forma letter from a selection. The application then updates the Call & allows the user to select the Subject(s) from the Subjects available (drop-down menu). If the user wants to write a second letter immediately, I get the above message. If they do anything else first, they are OK.
I have tried refreshing the Contacts form & each of the others at various points in the process, explictly saving the record (caused another error) etc. without success.
Can you help?
View 3 Replies
View Related
May 10, 2014
I have been working on a bound form that I can't seem to get working.
It records deliveries and what I am trying to achieve is after the form has been filled in the user will click a save button where the record will be added to the table and a record automatically printed via a report and emailed to the shop manager, but i keep getting the error "No Current record" no matter what way I try to do it, I have tried using to run the report. Is the best way for me to accomplish this o change it to an unbound for and run an insert query on click?
I have attached a copy of what I have been working on : DatabaseDelivery.accdb
View 2 Replies
View Related
Jul 3, 2007
Hi all,
I am in a trouble now..... please save me.
I did User Level Security wizard for my application. Is there any way to reverse that step I mean how can I delete this security option to make my application normal to open.
thanks for your help
mithani
View 3 Replies
View Related
Feb 3, 2005
Hello,
Can someone please tell me how to make it so that a user must save on a form or there is nothing entered into the table? As it stands anyone who views the form creates a new record.
Thanks in advance!
View 4 Replies
View Related
Jan 25, 2007
I have a problem where a user (with what I believe are the proper security settings) cannot save a new record in a form. I have set the securities on the form and the related table and query to allow this user to create new records (Add/Run).
This user is able to access the form and enter the data, but it will not save. I have added a "Save" button to no avail.
When I log on as the administrator, it works fine.
Any Ideas?
Thanks in advance.
View 3 Replies
View Related