Add a Hyperlink and Delete Button to Form (Subform)

red2002yzfr1

Registered User.
Local time
Today, 14:23
Joined
Jul 19, 2006
Messages
40
I am trying to add a button to a form that populates a sub form (data sheet) with hyperlinks. I also want to have a delete button available to delete these link(s), in case of wrong pick or attachment change.

I have searched and researched the topics available with no success. I have come across dead links, unable to open examples due to user rights, etc.

Any help would be greatly appreciated.
 
you want a button to delete the hyperlinks from the addresses, or you want a button to delete the entire subform population?? By population, I mean, to requery the subform, or just nullify it...??
 
I have succeeded in getting a button to delete a single record in a subform, here is the code:

Private Sub DeleteRecord_Click()
'Ask User if He/She really wants to Delete the Record...
If MsgBox("DELETE RECORD!" & vbCr & vbCr & _
"Are You Sure you want to Delete this Record?" & vbCr & _
"There is no Undo for this Delete.", vbExclamation + vbYesNo, _
"Delete Record") <> vbYes Then Exit Sub 'No..then outta here!
'Yes...then let's Delete the Record...
'Trap Errors
On Error Resume Next
'See to it that Access does not display the Delete Record Prompt.
DoCmd.SetWarnings False
'Set Focus to the SubForm
'This is the important part of getting this to delete just the single selected
'record.
'Me.[subFormName].SetFocus
'Me.[SubFormName].Form.SubFormField.SetFocus

Me.[Attachment(s)].SetFocus
Me.[Attachment(s)].Form.attachment.SetFocus

'Run the Delete Record Command
DoCmd.RunCommand acCmdDeleteRecord
'Let the Form carry through its events before we move on.
DoEvents
'Set the MS-Access Warning systems ON again
DoCmd.SetWarnings True
'If there was any Errors then Clear it.
If Err <> 0 Then Err.Clear
End Sub


Now I just need to get a button to open the MS dialog box and place the file path in these records that I can now delete.
 
I figured out how to get the MS dilaog box to open and to save a file path to a subform:

Private Sub cmdAddHyperlink_Click()

Dim strfilter As String
Dim strInputFileName As String

strfilter = ahtAddFilterItem(strfilter, "All Files (*.*)", "*.*")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strfilter, OpenFile:=True, _
DialogTitle:="Please select file...", _
Flags:=ahtOFN_HIDEREADONLY)


Me.[Attachment(s)].Form.attachment = strInputFileName

End Sub

Attached is a screen shot of my madness.
 

Attachments

  • Attachment.jpg
    Attachment.jpg
    35.5 KB · Views: 250

Users who are viewing this thread

Back
Top Bottom