Thanks for your quick reply. I believe I followed what you said but
nothing happens when I double click.
I created two new fields with the names you indicated and they were
both text boxes. In the the two boxes I put in the path to the photos
and the other the number of the jpg. Just as you indicated. I added
the two text boxes to my form
and then followed your intructions for the event procedure on the
double click. After the addition, it now looks like this:
Private Sub Command404_Click()
On Error GoTo Err_Command404_Click
Exit_Command404_Click:
Exit Sub
Err_Command404_Click:
MsgBox Err.Description
Resume Exit_Command404_Clic
Application.FollowHyperlink Me.MyPath & Me.MyPic, , , , ,
msoMethodGet
When I go back to the form and double click on the text box MyPic, I
get nothing.
What did I do wrong? Your instruction seemed quite simple.
Just to Check Ron, these 2 textboxes should be fields in your table, not
just text boxes into which you have written.
The code looks as if , rather than clicking on the text box field to add
your code to its double-click event, you have put a command button into your
form - one that would normally put your cursor on the previous field - thats
the bit that says
You've put your line of code in the bit that would only happen if there was
an error
The bit in the code that says
On Error GoTo Err_Command404_Click
just means
if something goes barf then go down to the line that says
Err_Command404_Click and do whatever it tells you to after that.
If you want to use a button then the code would look like this
I've put some explanations in it, they are the lines that start with a '
They will turn green when you paste them into a module and this means that
they won't effect the code in any way.
If any of them turn red, it will be because a line has been broken up in the
email, just delete the line break so that they become one line again
I've de-mystified the unnecessarily pompous bits of code, leaving the bits
that are actually necessary to make it work
Private Sub Command404_Click()
On Error GoTo MyCodeBarfed
'the next bit should all be one line
Application.FollowHyperlink Me.MyPath & Me.MyPic, , , , , msoMethodGet
LetsGetOutOfThis:
'stop the sub
Exit Sub
MyCodeBarfed:
MsgBox Err.Description
'tell them what went wrong
Resume LetsGetOutOfThis
'go back to the line
'that says LetsGetOutOfThis
End Sub
EVI:
I appreciate your patience on this problem. You are to be commended.
First of all, the 2 text boxes I added as to my table so hopefully I
did that part correctly.
I did have a command button on my form because I was trying all
possibilities. If this caused your code not to work, I apologize.
Since your last response, I went back to my original table (I have
been working with copies until I get this right) and deleted the
command button and started from scratch with your original code
suggestion.
At the point you indicated to "click just to the right of the [event
procedure] the code page does open up with some writing already in it.
The cursor goes to the space directly above "End Sub" at the bottom of
the writing. Before I add the code line you suggested, it reads as
follows:
Private Sub Command322_Click()
On Error GoTo Err_Command322_Click
DoCmd.GoToRecord , , acNext
Exit_Command322_Click:
Exit Sub
Err_Command322_Click:
MsgBox Err.Description
Resume Exit_Command322_Click
End Sub
Private Sub Command323_Click()
On Error GoTo Err_Command323_Click
DoCmd.GoToRecord , , acLast
Exit_Command323_Click:
Exit Sub
Err_Command323_Click:
MsgBox Err.Description
Resume Exit_Command323_Click
End Sub
Private Sub Command327_Click()
On Error GoTo Err_Command327_Click
DoCmd.GoToRecord , , acPrevious
Exit_Command327_Click:
Exit Sub
Err_Command327_Click:
MsgBox Err.Description
Resume Exit_Command327_Click
End Sub
Private Sub Command379_Click()
On Error GoTo Err_Command379_Click
DoCmd.GoToRecord , , acLast
Exit_Command379_Click:
Exit Sub
Err_Command379_Click:
MsgBox Err.Description
Resume Exit_Command379_Click
End Sub
Private Sub Command380_Click()
On Error GoTo Err_Command380_Click
DoCmd.GoToRecord , , acPrevious
Exit_Command380_Click:
Exit Sub
Err_Command380_Click:
MsgBox Err.Description
Resume Exit_Command380_Click
End Sub
Private Sub Command381_Click()
On Error GoTo Err_Command381_Click
DoCmd.GoToRecord , , acNext
Exit_Command381_Click:
Exit Sub
Err_Command381_Click:
MsgBox Err.Description
Resume Exit_Command381_Click
End Sub
Private Sub Command384_Click()
On Error GoTo Err_Command384_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command384_Click:
Exit Sub
Err_Command384_Click:
MsgBox Err.Description
Resume Exit_Command384_Click
End Sub
Private Sub Text393_DblClick(Cancel As Integer)
End Sub
Hopefully I have given you enough? I then have cut pasted the line of
code directly above the "End Sup".
At this point, I am not quite sure of the procedure to get back to my
form. I did hit the save buttonon the tool bar and then return using
the "X" in the upper right hand corner of the page. Next to the
"Double Click" on the Event tab the [Event Procedure] is there so I am
assuming all is well so far. Again I hit the save button as a
precaution.
Going back to my form view, the text box reads 1202.jpg which is what
I put in the table. When I double click on this text box now, I am
taken immediately to the code line that I just pasted. There is a box
that pops up that indicates a "Compile error: Method or data member
not found". I looked at the help button attached to this error
message, Error 461 by the way, and it referred to mispelled "object or
member names". I have since double checked my field names and they
appear to be what they are suppose to be, MyPath and MyPic and both
have the data time indicated as TEXT.
When I hit the OK button on the error message it goes into the code:
Private Sub Text393_DblClick(Cancel As Integer)
Application.FollowHyperlink Me.MyPath & Me.MyPic, , , , , msoMethodGet
End Sub
The first line only is highlighted in YELLOW and the".MyPath" is
highlighted in BLUE.
The good news is that I am getting a response when I double click on
the "MY PIC" field in my form. I did not really intend on using the
command button option and since this appears to be getting close, I
will stick with this concept.
Is this enough to figure out what is wrong?
Ron
Hi Ron
I can see the problem. You seem to have only partly followed my
instructions. I see that you are no longer using a button but have decided
to doubleclick a text box - that's fine.
But (assuming that MyPath and MyPic are the names of the fields in your
Table) the way to add them to your form is, in Form Design View, click the
the Field List then drag those fields onto your form. These text boxes will
have the names MyPath and MyPic.
I can see from your code that you added a textbox control to your form and
its Name (in Properties, on the Other tab) is Text393. I can tell this from
the Click Code..
. It is not called MyPic so when you tell the code to look for the value in
Me.MyPic, it expects to see a control (text box in this case) called MyPic..
Delete this text box and add a control as described above, If you don't want
to call your field names in your table MyPath and MyPic then we can adapt
the code to fit the field names you choose.
Evi