(Using Access 2003)
I have a an Object OLE field in a table where users can insert Excel sheets, Word Docs, Pdfs etc.
I need to create a button on a formulaire that allows the user to browse for, select and attach the file. The file must appear as an icon that can be double clicked on to be opened. The file should be stocked in the DB.
I can make a dialog box appear and browse for the file and copy the path into the field using this code: - Private Sub AttachButton_Click()
-
Dim varFile As Variant
-
-
With Application.FileDialog(msoFileDialogFilePicker)
-
With .Filters
-
.Clear
-
End With
-
.AllowMultiSelect = False
-
.InitialFileName = vbNullString
-
.InitialView = msoFileDialogViewDetails
-
-
If .Show = True Then
-
For Each varFile In .SelectedItems
-
Me![File] = varFile
-
Next
-
Else
-
MsgBox "No file attached ! "
-
End If
-
End With
-
End Sub
Thanks to: ADezii
(see http://bytes.com/topic/access/answer...ord-attachment)
But it needs to be an object sitting there, not just the path to the file.
Any help or alternative suggestions would be appreciated.
e
10 18988 ADezii 8,834
Recognized Expert Expert @EJaques
Rather than go into a detailed explanation, I've created a simple Database and made it available to you as an Attachment. Clicking on the Insert OLE Object Command Button will: - Open the Insert Object Dialog Box, from which you will:
- Select Create From File
- Browse ==> Select File to Insert ==> OK
- Select Display as Icon ==> OK
- The OLE Object will now be inserted into the OLE Object Field and displayed as an Icon.
- Double-Clicking on the Icon while in Form View will Open the File represented as an Icon in the Registered OLE Server for that File Type.
- No need for the File Dialog since the Insert Object Dialog will simply replace it.
- Good Luck, and Good Night!
Thank you that works very well
@ADezii
Can you pls provide the source code for the attachment, as I am new to VBA
ADezii 8,834
Recognized Expert Expert @kumar215 - Download the Attachment
- Set the Display Type Property of the Bound Object Frame to Icon
@ADezii
Thanks for reply, How can I get the file path name of file selected by using bound control ?
I need to show the complet file location in some text box.
ADezii 8,834
Recognized Expert Expert @kumar215
Download the Attachment which should say it all.
Thank you so much! This was extremely helpful!
Thanks a lot. Useful for me too
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ben |
last post by:
Hi all,
i have file input field in a form like this:
<input name="isbn" type="text" size="25" value="<?php echo
$_POST ?>" />
<input name="image" type="file" size="25" value="<?php echo
$_FILES ?>" />
when i press "submit" button, the same page gets loaded... if my
$_POST is empty, i want to have the file path on "file input
|
by: travis ray |
last post by:
Hi,
I have an extension in which a file object is created in python and
passed down to a c extension which attempts to read from it or write
to it. Writing to the file pointer seems to work okay, but reading
from it results in EBADF. It also causes python to crash on exit.
I've attached the minimal (I think) c code, python code, build script,
build log, and run log. Any and all help is greatly appreciated.
|
by: Sandi |
last post by:
I have a simple problem:
I have an Access database (images.mdb) that has 2 columns: one is the id of
the picture (an integer) and one (column named picture) is a field of type
OLE Object which contains an image (it can store jpg, bmp, gif, but I don't
know what image is stored inside).
I want to retrieve the picture stored in the database and identified by a
given id and display it in a web page (.aspx).
I write in Visual C#, but it does...
|
by: ohb |
last post by:
Hello,
is someone have a example of c# source
of a service which is reading a attach file
of an email.?
Thank you.
OHB.
|
by: ohb |
last post by:
Hello,
Is it possible to parse a attach file in a email ?
ohb
| |
by: Sandi |
last post by:
I have a simple problem:
I have an Access database (images.mdb) that has 2 columns: one is the id if
the picture (an integer) and one (column named picture) is a field of type
OLE Object which contains an image (it can store jpg, bmp, gif, but I don't
know what image is stored inside).
I want to retrieve the picture stored in the database and identified by a
given id and display it in a web page (.aspx).
I write in Visual C#, but it does...
|
by: Mark |
last post by:
Hello.
I am attempting to write binary data from a file to an
OLE Object field, and then write the file back out from
the database. I am reading and writing the files in
binary mode, and using GetChunk and AppendChunk to read
and write binary data from the OLE Object field. I am
using VBA and DAO for this experiment. The OLE Object
field is being used to store Long Binary data.
|
by: Vibhu |
last post by:
Hello All,
I have a input box on the HTML page with the type set to file. What I
want is that when the value changes in the file textbox, it should give
me the full file path. I have even tried passing the value to a hidden
control but all it does is passes only the File Name and not the file
path.
How do I go about it. I tried checking GMAIL service (Compose Mail) but
all I could get is that they are passing the window and the file...
|
by: RRsonawane11 |
last post by:
Hello,
Can anyone know how to write asp code to attach one file and email it to a
specified email address.
The attach file is the client choose from their Local Harddisk, just like we
using yahoo mail or hotmail , allow us to attach file and sent it.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |