Procedure worked and now doesn't

M

Mark A. Sam

Hello,

I wrote this procedure to allow insertion of a file name into a hyperlink
field. It worked and now doesn't.

Private Sub Doc_DblClick(Cancel As Integer)
On Error GoTo error_Section

DoCmd.RunCommand acCmdInsertHyperlink

Dim strDoc As String
Dim strDisplay As String
strDisplay = Mid(StrReverse([Doc]), 6, 9)
strDoc = [Doc]
[Doc].Value = strDisplay & "#" & strDoc & "#"


exit_Section:
Exit Sub

error_Section:
MsgBox "Error " & Err & ": " & Err.Description

End Sub


It brings up a window to browse for a file, inserts the file, then parses
out the file name to display in the text box. It worked fine, now it
inserts nothing into the textbox, and returns Error 3021, no current record.
Sometimes it return, Invalid us of null.

This is on the DblClick Event. The problem began when I put the procedure
in the Click Event of a button, adding a line, [Doc].Setfocus. From then
on, the error occured when I double click on the textbox. Thank you for any
help.

God Bless,

Mark A. Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top