carolanne1972
New member
- Local time
- Yesterday, 23:24
- Joined
- Aug 10, 2006
- Messages
- 3
http://www.access-programmers.co.uk/...ad.php?t=97787
I am attempting to add a command button on a form that will allow user to browse files, then select a MS Project file to import, then have it linked to the current record (by a hyperlink or icon of some sort) so that clicking on it will open that MS Project file.
I found the above thread and have imported the modules and the fFindOpenImportFile in order to test in my database. I have made only slight alterations to the code, as I am still a novice w/ VB, but may not have done so correctly. In the Private Sub bImport_Click, I inserted 'tbFile' where sample "C:\Windows\Win.ini" had previously been, so that it will import the file already selected from the bBrowse_Click. (If there is a cleaner/better way to do this, I would appreciate any help.)
Here is an exceprt from the code:
The imported form works great for 'Browse' or 'Open', but when I try 'Import', I get the following error:
2391- Field 'F1' doesn't exist in destination table 'tImport'
I even went back to the sample database and tested the form within the sample, using "win.ini" file and get the same error????
Of course, when I try it with an actual *.mpp file, I get this error:
31519- You cannot import this file.
...which leads me to believe that even if I fix the first error, I might be on the totally wrong path b/c it's an *.mpp file???
Any help would be greatly appreciated.
Thanks in advance for any help!
I am attempting to add a command button on a form that will allow user to browse files, then select a MS Project file to import, then have it linked to the current record (by a hyperlink or icon of some sort) so that clicking on it will open that MS Project file.
I found the above thread and have imported the modules and the fFindOpenImportFile in order to test in my database. I have made only slight alterations to the code, as I am still a novice w/ VB, but may not have done so correctly. In the Private Sub bImport_Click, I inserted 'tbFile' where sample "C:\Windows\Win.ini" had previously been, so that it will import the file already selected from the bBrowse_Click. (If there is a cleaner/better way to do this, I would appreciate any help.)
Here is an exceprt from the code:
Code:
Private Sub bImport_Click()
On Error GoTo Err_bImport_Click
Me.tbHidden.SetFocus
If IsNull(tbFile) Or tbFile = "" Then
MsgBox "Please browse and select a valid file to import.", vbCritical, "Invalid File"
Else
If Dir(tbFile) <> "" Then
CurrentDb().Execute "DELETE * FROM tImport"
'FileCopy "C:\WINNT\Win.ini", "C:\WINNT\Win.txt"
DoCmd.TransferText acImportDelim, , "tImport", "tbFile", False
MsgBox "Your file has been imported into the Database."
Else
MsgBox "Your computer does not have a C:\Windows\Win.ini file so the import example will not work.", vbInformation
End If
End If
Exit_bImport_Click:
Exit Sub
Err_bImport_Click:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_bImport_Click
End Sub
The imported form works great for 'Browse' or 'Open', but when I try 'Import', I get the following error:
2391- Field 'F1' doesn't exist in destination table 'tImport'
I even went back to the sample database and tested the form within the sample, using "win.ini" file and get the same error????

Of course, when I try it with an actual *.mpp file, I get this error:
31519- You cannot import this file.
...which leads me to believe that even if I fix the first error, I might be on the totally wrong path b/c it's an *.mpp file???

Any help would be greatly appreciated.
Thanks in advance for any help!
Last edited: