Open PDF File With Viewer

Dec 16, 2013

In my VBA (access 2003) project, Im struggling to open a pdf file using Adobe viewer/Reader. Is it possible ?

View Replies


ADVERTISEMENT

Linked Photos Open In IE Not In Default Photo Viewer

Aug 28, 2011

With XP photo linked in Access would open from Access in my default photo viewer. With Win 7 they only open in EI.

How do I fix Access in Win 7 so the links open in my default photo viewer like they did in XP?

View 4 Replies View Related

Modules & VBA :: File Open Dialog Does Not Allow Selection Of All File Types

Oct 4, 2013

I recently upgraded a DB from 2003 to 2013 and ran into the following problem.

I have a button that opens a file dialog box and allows the user to upload a file to a predetermined location (and store the address as a hyperlink). I borrowed this code from someone else on here and modified it slightly.

In any case, the button still works, but now when it opens it doesn't have an option for "All files" under file types. So I can upload MS Office files, text files, etc., but not PDF files which are by far the most common types my users upload.

Here's my code and a screenshot is attached.

Private Sub Command35_Click()
Dim dd As Integer
Dim fileDump As FileDialog
Set fileDump = Application.FileDialog(msoFileDialogOpen)
dd = fileDump.Show

[Code] ....

View 3 Replies View Related

Backup Current Access File Using Vba While The File Is Open

Jul 11, 2007

I have a button in the form of the current access file. What I want to do is when the user click on the button,
triggered the vba to backup current access file. But since the file is currently open, is this possible? If yes, may I know how to do it with vba?

I have tried two methods but failed:
1) Use copytofile method, but I get permission denied due to file open;
2) Use dbengine.compactdatabase method, but it also has problem if the file is open.

View 3 Replies View Related

Open Text File Using Only First 7 Characters Of File Name

Nov 7, 2013

I need to open and process the data from a text file on the network.

The first 7 characters of the file name will be the same every day.

The rest of the file name will change from day to day.

There will only be one file in the folder that has those first 7 characters.

There are a total of about 120 text files in the folder every day - give or take - including the one I need to open and read.

View 6 Replies View Related

General :: Open Save File Dialog - Select File From Text Box And Save To Selected Location

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

Access Viewer

Aug 18, 2005

I am working for a company that does not want to spend the money on another liceance for Microsoft Access. and I want to access my database from another location. Does anybody now of a 3rd party software that will allow me to run my database forms and enter in data or change data?

View 2 Replies View Related

Access Viewer

Mar 20, 2006

Is there any Access viewer from Microsoft, like the others for Word, Excel and PP?

It would be nice if clients can browse forms and print reports without having to buy Ms Office. But I could not find anyone.

View 2 Replies View Related

Image Viewer

Sep 16, 2004

I need to use any advanced viewer to view image from my access application>.....thanks for all

View 3 Replies View Related

Snapshot Viewer Orientation

Aug 28, 2006

Wonder whether anyone can help me?

Each day I produce reports from access and email then out using the snapshot viewer format. The majority of recipients open this find and the report is absolutely fine, however, when other recipients open the report it comes out all slanted and blurred. It almost looks like there snapshot viewer is squashing a landscape report into a portrait view. Does anyone know how to correct this, as its driving me mad trying to find an answer?

thanks:)

View 1 Replies View Related

Default Image Viewer

Mar 8, 2006

Just wondering can anyone help me please. I am only a learner with access so please go easy. :)

I am using access 2000.

Problem:

I have worked out from a lot of help from this forum how to put a cmd Button on my form to call the dialog window and store a file path in one of my text fields called “imagelinks” I can then view the image on a subform. I have two buttons one to insert a new image and another to delete the image. So far so good. Now I want to put another button on the form to preview the image with the default image browser. Can this be done so that if I gave a copy of the database to my friend and he has a different image browser the image can still be viewed by the click of that button.

I hope I have explained the above so it can be understood. :confused: myself.

Thanks in advance.

h

View 2 Replies View Related

Open Any File

Jun 2, 2005

hi there,

I thought my problem would be a common one but after spending enough time on the net and all forums i couldn't find my answer... anyway... here is my problem. The database is about creating reference, the table contains multiple references, i create a folder where i'll put all the files to be attached

I wanna a create a link to a file... the thing are :
- i want to open any kind of file (or at least i specify in a table what kind of file to open (jpg, pdf, etc...)
- The name of the file is different for ever record...
Anyway i think it will be more clear with the code :


Private Sub File_Name_Label_DblClick(Cancel As Integer)
Dim rst As New ADODB.Recordset
Dim file As String
Dim fold As String
Dim i As Integer

'Open Table Folder
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenStatic
rst.LockType = adLockPessimistic
rst.Open "SELECT * FROM Folders;"

fold = rst("Certificats")
rst.Close

rst.Open "SELECT * FROM FileType ORDER BY FileType.FileType DESC;"

'Find File

file = DocNo + rst("filetype")
If file <> "" Then GoTo OK
rst.MoveNext
OK:
'Open File
Application.FollowHyperlink file, , True
Bye:

'Close Table
rst.Close
Set rst = Nothing
End Sub

But there is an error (runtime error 490), any help would be appreciated

Thanks again ..

View 1 Replies View Related

Cannot Open .mdb File

Jan 25, 2007

Greetings,

I have a database I have been developing for some time that I can no longer access. I am running windows XP and Access 2003, I am the only user and it is stored on my local system. I was tweaking some VBA code in a few of the forms and closed the file which triggered the auto compact/repair. Everything appeared normal until I tried to open it again later. Now I cannot open the file, I do not get an error message or anything. When I click on the file Access opens and stops, never actually opens the database. If I try to open the file inside Access nothing happens. I have tried importing the objects into a new DB and still nothing happens inside Access. The real wierd part to me is that outside of Access everything is accessible. I can import tables from inside Excel with no trouble, I can put a button into a blank database that opens the other database through DAO and I can see all my tables, forms, data, etc. My problem is that I do not need the data, it is just test data at this point, I need to recover the VBA code from the Forms and I do not know how to do that without being able to open the database in Access.

Here is what I have tried so far (on copies of original DB):
-Compact and Repair inside Access: Nothing happens just like trying to do anything else with it inside Access
-Opened DB holding shift: Same Problem
-Copied file to two other Windows XP/Access 2003 systems: Same problem
-Used Jet Compact: The database file compacts successfully, still cannot open in Access
-Opened Access with /decompile: Same problem, Access opens, DB does not
-Created new DB and tried to import objects: Cannot open the old DB or see its objects
-Imported data from inside Excel: No problems, all tables/queries are available and all data appears correct
-Accessed file from new DB using DAO code: Everything appears normal, I can export the modules to text fine, but I have lots of code in forms that I cannot export
-Opened other databases in Access on same machine: No problems

I've done quite a bit of searching on this and have not found the same problem listed anywhere else. I do have daily backups so I'm not completely lost, but I made quite a few changes before it died that make it worthwhile for me to try and recover the file.

Any suggestions of other things to try? Is there any way to extract the VBA code inside a form from an .mdb file outside of Access?

Thanks for any ideas!

View 2 Replies View Related

Help - Cannot Open The File

May 30, 2007

Hi,

I was wondering if i could get some help here. I'm getting the following error message when trying to open MDB Access file.

Microsoft Access cannot open this file
This file is located outside your intranet or an untrusted site. ...

I did not get any problems like this before i upgraded my IE to IE-7 browser. I believe IE 7 has changed a bit of security setting there.

I can open up any apps(words, excel) without this error or problem apart from Access application. I then copied the Access file from my network drive onto my local machine - then it works fine.

I have been to IE-7 internet option tool to change the level of security especially the Local intranet and trusted site.
I have added in my Server IP address - 192.168.3.10 to Local Intranet. This doesn't help at all. I've run out ideas.

Note: this Access MDB file has already been on my server. I didnot get it from any emails. I got no problem with other PCs except for this PC i use.

Any help is appreciated.

Thank you in advance

View 2 Replies View Related

How To Set Print Attributes For The Relationship Viewer

Jun 29, 2006

I have a DB with about 50 tables. I have arranged them in a particular order in the relationship viewer and would like to print out as much of the viewer as I can by choosing the paper size and/or setting a scale factor. Access does not appear to let one do either. When looking at the relationship page, the 'page setup' under File ->Pagesetup is grayed out. Selecting 'print' causes the relationships to be printed in some sort of predefined manner, on 81/2x11 pages. Is there anyway to control how this view is printed?

On a related note: When in the relationship viewer, the only way to scroll the view is by the margin slider bars (the mouse wheel does not work). SHould the mouse wheel do the verticle scrolling? Also, if I want to move two or more tables (at the same time) in this view, how can I select them?

Thanks
John

View 2 Replies View Related

Snapshot Viewer Control Problem

Jul 24, 2006

I'm using the Snapshot Viewer control in one of my forms to display reports within the form. This works fine, except that with multiple page reports, there is no button to change pages, users have to right click and select 'next page.' In design mode the buttons to change pages and print appear at the bottom, but for some reason they don't show up when viewing the form in form view.

Has anyone run into this issue before?

Thanks

View 1 Replies View Related

Snapshot Viewer Problem - Very Strange

Sep 19, 2006

hi
i am using a macro with the outputTo method for a report. i have the report outputed as a snapshot file. it was working fine but now when it outputs the report the extension is missing; the file is created but with no extension. i tried changing the output format to excel but the extension was still missing. i also tried renaming my output report within the macro with the extension .snp and with .xls. snapshot viewer or excel would not open these programs.
anybody else come across this problem?
any ideas?

thanks

View 1 Replies View Related

How Can I Open A .mdf File In Access

Jul 16, 2005

Hi,

We have an old SQL server here which has died a horrible death and I need to get the data it contains out!

I have the .MDF files etc but I cannot seem to open them or import them in microsoft access.

I dont need to do anything flashy with it, just look at the tables!

Can anyone help?

Thanks

:)

View 14 Replies View Related

Open Old Access File

Oct 6, 2005

I am not an experienced Access developer.

I have a .mdb file that was created with Access 2000. Before I upgraded to 2003, I opened the file source by holding down 'shift' and double clicking the file. Now when I do that, it runs the application. How can I open the source file again.

Thanks

Anthony

View 1 Replies View Related

File Open Query

Feb 10, 2006

I've need to be able to open up another db while in the current db.

Atm I have to start the db, then goto file open, goto the t: and then select the correct .mdb file, as I have no control over the db, this is the solution we were provided.

Now what I would like to do is ammend the main menu screen on the first Db so that it has a button that will automatically open the newer .mdb, but I can't work out the correct scripting I need.

Can someone possibly help me please.

View 3 Replies View Related

Open File From Text Box

Dec 29, 2004

Hello,

I have an Access database that needs to open a file. Unfortunately, the text file is named 17.Ghost.Y87777_Extract.txt, where Y87777 changes per file. What I am trying to accomplish is have a text box on a form that you will type in a value, such as the Y87777 and let the entire string open a text file through a VBA. The problem is that, in my VBA I get an error file not found. The text box is called txtImport. In my VBA, I have the code set up as:

Dim myRecord as string

myRecord = Me.txtImport

Then to open the file:

C:Import17.Ghost.MyRecord_Extract.txt

Does placing myRecord inside of the string cause the problem?

View 4 Replies View Related

Open File Dialog

Oct 26, 2006

Another question:

I used the suggested code from this forum to import a file with the open file dialog box. It works great to that point, but how do I specify which table I want it to populate with this data?? Thanks!

Here's the code:

vb Code: Original - vb Code Type tagOPENFILENAMElStructSize As LonghwndOwner As LonghInstance As LongstrFilter As StringstrCustomFilter As StringnMaxCustFilter As LongnFilterIndex As LongstrFile As StringnMaxFile As LongstrFileTitle As StringnMaxFileTitle As LongstrInitialDir As StringstrTitle As StringFlags As LongnFileOffset As IntegernFileExtension As IntegerstrDefExt As StringlCustData As LonglpfnHook As LonglpTemplateName 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 StringDim lngFlags As LongstrFilter = 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_NOCHANGEDIRIf IsMissing(varDirectory) ThenvarDirectory = ""End IfIf IsMissing(varTitleForDialog) ThenvarTitleForDialog = ""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) ThenvarFileName = TrimNull(varFileName)End IfGetOpenFile = 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 = CurDirIf IsMissing(Filter) Then Filter = ""If IsMissing(FilterIndex) Then FilterIndex = 1If 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.hWndAccessAppIf 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 functionWith 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 = 255End 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 ThenfResult = aht_apiGetOpenFileName(OFN)ElsefResult = 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.FlagsahtCommonFileOpenSave = TrimNull(OFN.strFile)ElseahtCommonFileOpenSave = vbNullStringEnd 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 IntegerintPos = InStr(strItem, vbNullChar)If intPos > 0 ThenTrimNull = Left(strItem, intPos - 1)ElseTrimNull = strItemEnd IfEnd FunctionPrivate Sub Command20_Click()Dim strFilter As StringDim strInputFileName As StringstrFilter = ahtAddFilterItem(strFilter, "CSV Files (*.csv)", "*.csv")strInputFileName = ahtCommonFileOpenSave( _Filter:=strFilter, OpenFile:=True, _DialogTitle:="Please select an input file...", _Flags:=ahtOFN_HIDEREADONLY)End Sub'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, 1996 Type tagOPENFILENAMElStructSize As LonghwndOwner As LonghInstance As LongstrFilter As StringstrCustomFilter As StringnMaxCustFilter As LongnFilterIndex As LongstrFile As StringnMaxFile As LongstrFileTitle As StringnMaxFileTitle As LongstrInitialDir As StringstrTitle As StringFlags As LongnFileOffset As IntegernFileExtension As IntegerstrDefExt As StringlCustData As LonglpfnHook As LonglpTemplateName As StringEnd Type Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As BooleanDeclare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long Global 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 = &H200000 Function TestIt()Dim strFilter As StringDim lngFlags As LongstrFilter = 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 Function Function 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_NOCHANGEDIRIf IsMissing(varDirectory) ThenvarDirectory = ""End IfIf IsMissing(varTitleForDialog) ThenvarTitleForDialog = ""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) ThenvarFileName = TrimNull(varFileName)End IfGetOpenFile = varFileNameEnd Function Function 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 = CurDirIf IsMissing(Filter) Then Filter = ""If IsMissing(FilterIndex) Then FilterIndex = 1If 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.hWndAccessAppIf 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 functionWith 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 = 255End 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 ThenfResult = aht_apiGetOpenFileName(OFN)ElsefResult = 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.FlagsahtCommonFileOpenSave = TrimNull(OFN.strFile)ElseahtCommonFileOpenSave = vbNullStringEnd IfEnd Function Function 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 Function Private Function TrimNull(ByVal strItem As String) As StringDim intPos As IntegerintPos = InStr(strItem, vbNullChar)If intPos > 0 ThenTrimNull = Left(strItem, intPos - 1)ElseTrimNull = strItemEnd IfEnd Function Private Sub Command20_Click() Dim strFilter As String   Dim strInputFileName As String strFilter = ahtAddFilterItem(strFilter, "CSV Files (*.csv)", "*.csv")strInputFileName = ahtCommonFileOpenSave( _Filter:=strFilter, OpenFile:=True, _DialogTitle:="Please select an input file...", _Flags:=ahtOFN_HIDEREADONLY) End Sub '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, 1996  


Thanks!!

KellyJo

View 1 Replies View Related

Open File Dialog Box

Mar 9, 2007

Hello,

I would like to put a cmdbutton on a form to open the File Dialog box directly from Access whereby users can search through folders and open a any file selected.
I have searched the web and found a link:

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

I have copied the code into a module and the code behind the cmdbutton but getting an error.
Can anyone help me is finding a solution or an example? Thanks.

View 14 Replies View Related

Database Does Not Want To Open MDA File

Jul 28, 2013

after I upgraded to win 7 my database refuses to use an .mda file, to which I refer to (Visual Basic menu, extras). I get the message that I should have installed this .mda file with administrator rights. I am the only user and administrator of my computer, and i cannot install this file (which I bought a long time ago) other than put it either into ....../office12 or into windows/system12 or windows/syswow64.I tried to register it under DOS (with administator rights) with regsvr32.exe but there I got the message that I should check whether this .mda is a 32 or 64 bit version.

View 3 Replies View Related

Crystal Reports Viewer Active X Control

Feb 26, 2006

Could anyone point me in the right direction re the Crystal Reports Active X viewer control and access forms. I loaded it onto a form in access 2000, but can't seem to find any meaningfull properties I can manipulate (especially the report source). I am thinking it works like any other active x control and I can manipulate properties through code, however, the main property I would think I need (source report) does not seem to exist. I have Crystal 10.0 loaded on my system.

View 1 Replies View Related

Third Party Control - Kodak Image Viewer

Apr 6, 2006

I have a database that was built by some users, long before I came to my current job location (oh yes, one of those fun issues), and have run into an error that is involving a 3rd party tool, and is tough to duplicate.

There is an ocx control named "Kodak Image Thumbnail control" the path is C:winntsystem32ImgThumb32.ocx.

This is an active x control, that on the double click event, opens up the correct corresponding .pdf file. It works correct for me, on my machine. It works correctly for 3 other people on their own machines. When we had a user it worked correctly log into a user who it does not work correctly, it then worked correctly for them (appears to be user rights, and not machine specific). It does not work correctly for another 2-4 users (not sure the exact number).

But, the rights were gone over with a fine tooth comb, and nothing was found different from each user.

What is weird, is how the error occurs. There are 59 records in the database, with a linking .pdf file displayed in this .ocx control. For those users in which this does not work, the first two records open the .pdf correctly. After this (records 3 to 59) they receive the following error:

"Microsoft Access can't open the file containing the OLE object.

- You may have specified an invalid file name or an invalid unit of data (such as a range of cells from a worksheet) when the file for the OLE object.
- The file you specified may not be available because it's locked by another user or you don't have permission to use it.

Try one of the following:
- Make sure the file is available and that you used the correct file name.
- Check the OLE server's documentation for information about the syntax to use when specifiying an OLE object's data."

[OK]

Since this is a third party tool, that I have never used, and do not even have on my machine (yet it works correctly for me) I am not sure what else I can do to track down the error. I just wanted to see if anyone else has run into this error, and if so how they had fixed it.

Thank you for your time.

T.J.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved