how to make a bottoun for inserting an object to database

K

Klatuu

What kind of object? Where will you be getting the object?
There is pleanty of white space to include details in your question.
 
G

ghost

e.g. pdf,doc, html,......

Klatuu said:
What kind of object? Where will you be getting the object?
There is pleanty of white space to include details in your question.
 
K

Klatuu

Yes, linking would be a better idea. Create a hyperlink data type field in
your table and put the path to the file in it.
 
G

ghost

but , how can i insert the link at the form, i have a form to be filled from
other users
"user interface"
 
K

Klatuu

At this site http://www.mvps.org/access/api/api0001.htm
you will find code that will allow you to present the common open file
dialog to the user and allow them to navigate to and select the file. When
the user clicks on the file or selects it and clicks okay, it will return the
full path and name of the file as a string. If the user cancels, it returns
a zero length string.

The issue is that it returns a path in Drive Letter Mapping format
(G:\SomeFolder\AFile.pdf). In a multi user environment, different users will
have different drive mappings, which will create a problem. What you need to
do is convert the drive map to a UNC path (\\ServerName\SomeFolder\AFile.pdf)
so it will work for any user.

Here is another link that will have the code necessary to change a drive map
to a UNC path
http://www.mvps.org/access/api/api0003.htm

Good Luck
 
K

Klatuu

The code from each site should be put in it's own standard module.
I can't really tell you where to call it from, because I don't know anything
about your form or how you are going to do the links. If it is for a command
button, you would call the functions in the code modules from the click event
of the command button.

Here is a sample where I call the dialog box to select a file:

'Flags Hides the Read Only Check and Only allow existing files
lngFlags = ahtOFN_HIDEREADONLY Or ahtOFN_FILEMUSTEXIST
'Set filter to show only Access Databases
strFilter = ahtAddFilterItem(strFilter, "Access (*.mdb,*.mde)",
"*.MDB;*.MDA")
'Call the Open File Dialog
Do While True
varGetFileName = ahtCommonFileOpenSave( _
OpenFile:=True, _
Filter:=strFilter, _
Flags:=lngFlags, _
DialogTitle:=strDialog)
If varGetFileName = "" Then 'User Clicked CANCEL
If MsgBox("Retry to select a Database " & vbNewLine & "Or" _
& vbNewLine & "Cancel to Quit", vbExclamation +
vbRetryCancel, _
"No Database Selected") = vbCancel Then
Exit Do
End If
Else
Exit Do
End If
Loop
NewDatabasePath = varGetFileName

And here is how you change it to a UNC path:
Me.datapath = fGetUNCPath(Left(varGetFileName, 2)) &
Right(varGetFileName, Len(strPath) - 2)
 
Top