Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link document to record

Status
Not open for further replies.

kaldag

MIS
Dec 2, 2002
24
0
0
US
I have a user data base with Last Name, First name and other normal demographics.
How can I assign the first and last name to the document and create a command button that will link to it. This needs to be totally automated as the end users don't understand how to rename and save files.

Ken
 
Hi Kaldag!
By [!]document[/!] do you Microsoft Word document or something else?

Also, I'm not sure what you mean by link a command button to it... What would you like the command button to do?

Does this have to do with saving and renaming Word docs?

Sorry to ask so many questions, but I'm not sure how to help.

Tom

Born once die twice; born twice die once.
 
Yes a MS Word Document.

I would like a process that would link the record to the Word document by clicking on a button.

Hope this is a little clearer. (MUD) :)

Ken

 
Well, we are getting a little closer. [wink]

Upon clicking the command button, do you want to export the active record to Word, then have the db automatically assign a name and put the newly created Word doc in a preassigned folder or...

Sorry to be so meatheaded about this, but I'm still unclear about what you would like to accomplish. Unfortunately, Access is even less of a fortune teller than I am...[smile]

A little more information?

Tom

Born once die twice; born twice die once.
 
I feel that I am wasting your time. Here is the process.

We enter the demographics into the Access DB.

There is a word documnet that is associated with that record.

How can my users connect that document with that record so later thay can click on a button on the form to bring up the document that is linked to the record?

Sorry for the confusion.

Ken
 
Have a look at the FollowHyperlink method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The code below fill 2 list boxes from tables, But you should be able to modify it to your needs.


Function GetExampleList()
' This procedure is called from the OnOpen property setting of the
' Your form and from the OnChange event procedure for
' the tab control on the your form. It fills the list
' box control.

Dim frm As Form, ctlTab As TabControl
Dim ctlList As ListBox, ctlListExamples As ListBox
Dim strListSQL As String

On Error Resume Next

Set frm = Forms!YourForm
Set ctlListExamples = frm!lstExamples
strListSQL = "Select * FROM yourHyperformObjects
ctlListExamples.RowSource = strListSQL & ctlList.Column(0)
End Function

Function CheckIndex()
' This procedure is called from the OnChange property setting
' of the Your form. It forces the first item in the
' list box control on each tab to be selected if there is no current
' selection.
Dim ctlList As Control
Set ctlList = Screen.ActiveControl

If ctlList.Properties("ListIndex") = -1 Then
ctlList.Properties("ListIndex") = 0
End If
' Fill the examples list box.
GetExampleList
End Function
Function ClearList() As Integer
' This procedure is called from the OnUnload property of the
' yourform to clear the entries in the
' lstExamples list box control.
Dim frm As Form
Dim ctlList As ListBox
Set frm = Forms!yourForm
Set ctlList = frm!lstExamples
ctlList.RowSource = ""
End Function
Function GetExampleObject() As Integer
' This procedure is called from the OnClick property of the cmdOK button
' on the your form and gets the information needed to call
' the CreateHyperlink procedure below.

Dim frm As Form
Dim ctlList As ListBox, cmdOK As CommandButton
Dim objName As String, objType As String, strSubAddress As String

Set frm = Forms!YourForm
Set ctlList = frm!lstExamples
Set cmdOK = frm!cmdOK

If IsNull(ctlList.Column(2)) Then
MsgBox "Please select an example from the list."
Exit Function
Else
objName = ctlList.Column(2)
objType = ctlList.Column(3)
If objType = "Dialog" Then objType = "Form"
strSubAddress = objType & " " & objName
End If
' Web toolbar turned off here; otherwise it would appear
' automatically when the Follow method is invoked in the
' CreateHyperlink procedure.
DoCmd.ShowToolbar "Web", acToolbarNo

CreateHyperlink cmdOK, strSubAddress

End FunctionFunction GetExampleList()
' This procedure is called from the OnOpen property setting of the
' yourform form and from the OnChange event procedure for
' the tab control on the SolutionsHyperform form. It fills the list
' box control for the current tab.

Dim frm As Form, ctlTab As TabControl
Dim ctlList As ListBox, ctlListExamples As ListBox
Dim strListSQL As String

On Error Resume Next

Set frm = Forms!SolutionsHyperForm
Set ctlTab = frm!ctlTab
Set ctlListExamples = frm!lstExamples
strListSQL = "Select * FROM yourformObjects WHERE TopicID = "


ctlListExamples.RowSource = strListSQL & ctlList.Column(0)
End Function

Function CheckIndex()
' This procedure is called from the OnChange property setting
' of the Yourform form. It forces the first item in the
' list box control on each tab to be selected if there is no current
' selection.
Dim ctlList As Control
Set ctlList = Screen.ActiveControl

If ctlList.Properties("ListIndex") = -1 Then
ctlList.Properties("ListIndex") = 0
End If
' Fill the examples list box.
GetExampleList
End Function
Function ClearList() As Integer
' This procedure is called from the OnUnload property of the
' Yourform form to clear the entries in the
' lstExamples list box control.
Dim frm As Form
Dim ctlList As ListBox
Set frm = Forms!YourForm
Set ctlList = frm!lstExamples
ctlList.RowSource = ""
' Show your form if it is open but not Visible.
End Function
Function GetExampleObject() As Integer
' This procedure is called from the OnClick property of the cmdOK button
' on the SolutionsHyperform form and gets the information needed to call
' the CreateHyperlink procedure below.

Dim frm As Form
Dim ctlList As ListBox, cmdOK As CommandButton
Dim objName As String, objType As String, strSubAddress As String

Set frm = Forms!SolutionsHyperForm
Set ctlList = frm!lstExamples
Set cmdOK = frm!cmdOK

If IsNull(ctlList.Column(2)) Then
MsgBox "Please select an example from the list."
Exit Function
Else
objName = ctlList.Column(2)
objType = ctlList.Column(3)
If objType = "Dialog" Then objType = "Form"
strSubAddress = objType & " " & objName
End If
' Web toolbar turned off here; otherwise it would appear
' automatically when the Follow method is invoked in the
' CreateHyperlink procedure.
DoCmd.ShowToolbar "Web", acToolbarNo

CreateHyperlink cmdOK, strSubAddress

End Function

Never give up never give in.

There are no short cuts to anything worth doing :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top