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 Replies


ADVERTISEMENT

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

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 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

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 4 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

Open A Word File From A Form

Jun 5, 2005

Hi all
I need to run a certain file from the form
I create a button as follows
Select in the categories "Applications" then select "Run Ms Word"
I have tested it and it open Word but not even a blank page
I then open the code as seen below and want to insert the filename but do not know where. Can someone please help me?

Private Sub Command35_Click()
On Error GoTo Err_Command35_Click

Dim oApp As Object

Set oApp = CreateObject("Word.Application")
oApp.Visible = True

Exit_Command35_Click:
Exit Sub

Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click

End Sub

The file is - D:PanelbeatersPb Manual.doc

View 2 Replies View Related

OPen A File And Save With Access

Dec 10, 2005

Good Afternoon,

Does anyone know where I can find a sample db that will let the user do the following:

Selected a file from their computer and upload to a the same folder as the db?

I am building an Investigation database. This function will allow the user to attach file to an investigation. (the files will be stored in a folder and logged on a table)

Any help would be great.

Thanks,

Bones

View 2 Replies View Related

Help Me! Error When Open Existing File...

Sep 28, 2006

I'm begin study Microsoft Access but have error and don't know how!
(Please see the attach picture)

I'm use Window XP Pro and Office 2003.

I'm already update window and Jet 4.0 Service Pack 8 (SP8) for Windows XP at link but nothing to change (http://www.microsoft.com/downloads/details.aspx?FamilyID=2deddec4-350e-4cd0-a12a-d7f70a153156&DisplayLang=en)

Please advise me the way to repair this error!!!

View 5 Replies View Related

Microsoft Access Cannot Open This File

Nov 15, 2006

Hi,
I am trying to open an access database (Access2002) from my computer ( C: est )
and I receive the error :
Microsoft Access cannot open this file.
This file is located outside your intranet or on an untrusted site.

how can I fix this problem ?

regards,
Jam

View 3 Replies View Related

Microsoft Access Cannot Open This File

Feb 14, 2007

We have a database on our network server which I cannot open. I get the following error everytime I try to access it.

This file is located outside your or on an untrusted site. Microsoft Access will not open the file due to potential security problems. To open the file, copy it to your machine or an accessible network location.

I think it has to do with a Microsoft Jet 4.0 Service Pack 8 security update. However, I cannot find the update to uninstall. Others can access the database located on the network, but some get a pop-up that allows them to say "no" and access the file. The pop-up has the following message:

Security Warning: Unsafe expressions are not blocked. Do you want to block unsafe expressions?

Can anyone help with this?

View 10 Replies View Related

Need Button To Open HTML FAQ File

Nov 8, 2007

Hey again all!

Implementation is going fabu, but I had a request to add a button on the main form to open the HTML FAQ I wrote. I thought I would be able to quickly point the button to the file using the button creation wizard, but that doesn't seem to work so well. (not at all)

Did I miss something or is this something that needs to be coded with VBA (very little knowledge of VBA here... negligible even.)

View 1 Replies View Related

Access Wont Open A File

Jan 22, 2008

The file is part of a students exam, so a bit urgent!

The file just will not open, either by double click or open in Access. Tried holding shift, not the problem, not hidden or anything, just that trying to open brings up the first warning box (we have very strict security on students computers!) but after that nothing, no sign of an error or anything having been loaded. Tried compress & repair and the microsoft tool for compressing JET files, that did give an error when it tried, just saying error compacting database.

I've tried importing the file into a new database using access, that gives no results, but importing tables into excel does!

Anyone anyideas short of paying for it to be done?

:confused:

View 10 Replies View Related

How Do I Use A Form Field To Open A File On My PC ?

Jun 2, 2005

I am trying to write a little database to view my MP3 collection (as you do when youre bored...)

I have a field that shows the full path to my MP3's

e.g "D:My MP3'siTunes MusicBob DylanDesire3 Mozambique.mp3"

I want to be able to click on the file link to launch the file in my MP3 player - I have tried changing the field type to "hyperlink", but that still doesn't work...

Any help greatly appreciated.

View 2 Replies View Related

Click And Open A File (I'm Sure It's Elementary)

Aug 26, 2005

I have created a database where I store my ebooks.
Therefore, let's assume that in the field "Title" there is an entry called "cooking.pdf". The file is physically stored, let's say at C:MyEbookscooking.pdf
I created a query where I get the records of the table (all or filtered) and I added a field where I wrote 'Link to Open: "C:MyEbooks"+[title] where title is the name of the field in the table, where the filename is stored.

Then I created a Form which represents the query's fields. On the properties of that last field I changed at the bottom the Boolean parameter 'Is Hyperlink' to Yes.

I assumed that by clicking on that field I will have the book opened automatically for me. Alas, it doesn't work...

I guess, it needs some piece of code, maybe in Visual Basic, which is the lang that Office is using. It's not my strenght though...

Any ideas on how to achieve this (maybe a button with a code)

View 9 Replies View Related

Open Pdf File Using A MS Access Combo Box

Jul 9, 2004

Is it possible to open a pdf file that has been saved on a server?

What I have is a table that lists all of the files that have been saved to pdf. There is a column in that table that lists the exact path and file name. There is a combo box on a form that lists those file names. I need to know if there is VB code that will use that specific file name listed in the combo box and open (to view) the pdf file on the server.

Thank you so much for any help and insight provided.

View 7 Replies View Related

Open A Word File Within Access

Jan 11, 2007

I would like to Open a Word file throught Access code.
With the following code I can start Word, but how can I specify the file name I want to Open:

Dim wrdApp As Object
Set wrdApp = CreateObject("Word.application")
wrdApp.Visible = True

Thanks

View 2 Replies View Related







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