combine 2 table fields on a form to create a hyperlink button

G

Guest

Hey all, and thanks for reading my question,

I've created a table called, [tbl_OtherReference]. One field in
[tbl_OtherReference] is a text field, called [fileName], which will hold the
name of a file with it's extension. For example, I'm using the file
"trial.xls" as my trial file. The second field, called [path], is the path to
this file. For "trial.xls", the path is simply, "C:\". (without the quotes of
course)

I'd like to combine these two fields on my form creating an active Hyperlink
to the specified document, most likely the hyperlink would be a button they
could push. For the example above, this would look like this now for the
hyperlink:

OnClick, go to here and open this file, [C:\trial.xls], just the way it's
supposed to. Only, I don't know the code.

Is this possible?

My boss indicated that he'd like the table [tbl_OtherReference] to be
completely editable. So, I'm thinking I'll create a subform in the form for
this table. The subform will be completely editable, and next to the subform
will be the buttons I'm talking about.

Thanks so much!

-Blenvid
 
G

Guest

Hi Klatuu,

Thanks for your response.

I tried your code. I am getting a, "Runtime error, 424, Object Required"
error message. What could this mean?

-Blenvid

Klatuu said:
Application.FollowHyperlink rst![path] & rst![filename]

Blenvid said:
Hey all, and thanks for reading my question,

I've created a table called, [tbl_OtherReference]. One field in
[tbl_OtherReference] is a text field, called [fileName], which will hold the
name of a file with it's extension. For example, I'm using the file
"trial.xls" as my trial file. The second field, called [path], is the path to
this file. For "trial.xls", the path is simply, "C:\". (without the quotes of
course)

I'd like to combine these two fields on my form creating an active Hyperlink
to the specified document, most likely the hyperlink would be a button they
could push. For the example above, this would look like this now for the
hyperlink:

OnClick, go to here and open this file, [C:\trial.xls], just the way it's
supposed to. Only, I don't know the code.

Is this possible?

My boss indicated that he'd like the table [tbl_OtherReference] to be
completely editable. So, I'm thinking I'll create a subform in the form for
this table. The subform will be completely editable, and next to the subform
will be the buttons I'm talking about.

Thanks so much!

-Blenvid
 
G

Guest

If you used it exactly as I posted it, you will get that error. Since I did
not know how you are getting your info out of your table, I could not be
exact. It is only an example to show how to concatenate two strings. This
standard concatenation technique works in almost all cases. Just substitue
the rst![path] and rst![filename] with whatever variables have the values you
need.

Blenvid said:
Hi Klatuu,

Thanks for your response.

I tried your code. I am getting a, "Runtime error, 424, Object Required"
error message. What could this mean?

-Blenvid

Klatuu said:
Application.FollowHyperlink rst![path] & rst![filename]

Blenvid said:
Hey all, and thanks for reading my question,

I've created a table called, [tbl_OtherReference]. One field in
[tbl_OtherReference] is a text field, called [fileName], which will hold the
name of a file with it's extension. For example, I'm using the file
"trial.xls" as my trial file. The second field, called [path], is the path to
this file. For "trial.xls", the path is simply, "C:\". (without the quotes of
course)

I'd like to combine these two fields on my form creating an active Hyperlink
to the specified document, most likely the hyperlink would be a button they
could push. For the example above, this would look like this now for the
hyperlink:

OnClick, go to here and open this file, [C:\trial.xls], just the way it's
supposed to. Only, I don't know the code.

Is this possible?

My boss indicated that he'd like the table [tbl_OtherReference] to be
completely editable. So, I'm thinking I'll create a subform in the form for
this table. The subform will be completely editable, and next to the subform
will be the buttons I'm talking about.

Thanks so much!

-Blenvid
 
G

Guest

Hi Klatuu,

I am getting the info. out of my [tbl_OtherResources] table with a subform.

I'm not very familiar with VB, but I have experience with C++ and Java, so I
know what you're saying about strings. I suppose the solution then is for
each record of the table, extract the contents of the 2 fields into two
seperate variables, then concatenate the two strings. Then the code you gave
me will work right?

This sounds like a looping structure, which will continue until it's
finished with all the records. Unfortunately, I have no experience doing this
in VB so I guess I'll have to look that up too.

Any additional help would be greatly appreciated.

-Blenvid

Klatuu said:
If you used it exactly as I posted it, you will get that error. Since I did
not know how you are getting your info out of your table, I could not be
exact. It is only an example to show how to concatenate two strings. This
standard concatenation technique works in almost all cases. Just substitue
the rst![path] and rst![filename] with whatever variables have the values you
need.

Blenvid said:
Hi Klatuu,

Thanks for your response.

I tried your code. I am getting a, "Runtime error, 424, Object Required"
error message. What could this mean?

-Blenvid

Klatuu said:
Application.FollowHyperlink rst![path] & rst![filename]

:

Hey all, and thanks for reading my question,

I've created a table called, [tbl_OtherReference]. One field in
[tbl_OtherReference] is a text field, called [fileName], which will hold the
name of a file with it's extension. For example, I'm using the file
"trial.xls" as my trial file. The second field, called [path], is the path to
this file. For "trial.xls", the path is simply, "C:\". (without the quotes of
course)

I'd like to combine these two fields on my form creating an active Hyperlink
to the specified document, most likely the hyperlink would be a button they
could push. For the example above, this would look like this now for the
hyperlink:

OnClick, go to here and open this file, [C:\trial.xls], just the way it's
supposed to. Only, I don't know the code.

Is this possible?

My boss indicated that he'd like the table [tbl_OtherReference] to be
completely editable. So, I'm thinking I'll create a subform in the form for
this table. The subform will be completely editable, and next to the subform
will be the buttons I'm talking about.

Thanks so much!

-Blenvid
 
G

Guest

If you want to spin through your table and do it for every record:
You may want to look in the VB Editor Help for Info on the FollowHyperlink
method. There are some other arguements that may be things you want to use.
Also, I am curious about doing this, because each iteration of the Do Loop
will either Open a File or go to a web site, depending on what the link it to.

Sub DoTheLinks
Dim dbf As Database 'variable for database object reference
Dim rst As Recordset 'varialbe for recordset object reference
Dim app As Applicationi 'variable for application object reference

set dbf = CurrentDb
set rst = dbf.OpenRecordset("tbl_OtherResources", dbOpenSnapshot)
If rst.RecordCount = 0 Then
MsgBox "No Records To Process", vbExclamation
Else
Do While Not rst.Eof
app.FollowHyperlink rst![path] & rst![filename]
rst.MoveNext
Loop
End If
rst.Close
set rst = Nothing
set dbf = Nothing
set app = Nothing
End Sub

Blenvid said:
Hi Klatuu,

I am getting the info. out of my [tbl_OtherResources] table with a subform.

I'm not very familiar with VB, but I have experience with C++ and Java, so I
know what you're saying about strings. I suppose the solution then is for
each record of the table, extract the contents of the 2 fields into two
seperate variables, then concatenate the two strings. Then the code you gave
me will work right?

This sounds like a looping structure, which will continue until it's
finished with all the records. Unfortunately, I have no experience doing this
in VB so I guess I'll have to look that up too.

Any additional help would be greatly appreciated.

-Blenvid

Klatuu said:
If you used it exactly as I posted it, you will get that error. Since I did
not know how you are getting your info out of your table, I could not be
exact. It is only an example to show how to concatenate two strings. This
standard concatenation technique works in almost all cases. Just substitue
the rst![path] and rst![filename] with whatever variables have the values you
need.

Blenvid said:
Hi Klatuu,

Thanks for your response.

I tried your code. I am getting a, "Runtime error, 424, Object Required"
error message. What could this mean?

-Blenvid

:

Application.FollowHyperlink rst![path] & rst![filename]

:

Hey all, and thanks for reading my question,

I've created a table called, [tbl_OtherReference]. One field in
[tbl_OtherReference] is a text field, called [fileName], which will hold the
name of a file with it's extension. For example, I'm using the file
"trial.xls" as my trial file. The second field, called [path], is the path to
this file. For "trial.xls", the path is simply, "C:\". (without the quotes of
course)

I'd like to combine these two fields on my form creating an active Hyperlink
to the specified document, most likely the hyperlink would be a button they
could push. For the example above, this would look like this now for the
hyperlink:

OnClick, go to here and open this file, [C:\trial.xls], just the way it's
supposed to. Only, I don't know the code.

Is this possible?

My boss indicated that he'd like the table [tbl_OtherReference] to be
completely editable. So, I'm thinking I'll create a subform in the form for
this table. The subform will be completely editable, and next to the subform
will be the buttons I'm talking about.

Thanks so much!

-Blenvid
 
G

Guest

Great Klatuu. Thanks. I'll have to check out the code on Monday when I'm back
at work. Even if it doesn't work, you've give me enough to go on that I
probably could figure it out. :)

Thanks again,
Blenvid

ps- I'll repost on Monday with an update.

Klatuu said:
If you want to spin through your table and do it for every record:
You may want to look in the VB Editor Help for Info on the FollowHyperlink
method. There are some other arguements that may be things you want to use.
Also, I am curious about doing this, because each iteration of the Do Loop
will either Open a File or go to a web site, depending on what the link it to.

Sub DoTheLinks
Dim dbf As Database 'variable for database object reference
Dim rst As Recordset 'varialbe for recordset object reference
Dim app As Applicationi 'variable for application object reference

set dbf = CurrentDb
set rst = dbf.OpenRecordset("tbl_OtherResources", dbOpenSnapshot)
If rst.RecordCount = 0 Then
MsgBox "No Records To Process", vbExclamation
Else
Do While Not rst.Eof
app.FollowHyperlink rst![path] & rst![filename]
rst.MoveNext
Loop
End If
rst.Close
set rst = Nothing
set dbf = Nothing
set app = Nothing
End Sub

Blenvid said:
Hi Klatuu,

I am getting the info. out of my [tbl_OtherResources] table with a subform.

I'm not very familiar with VB, but I have experience with C++ and Java, so I
know what you're saying about strings. I suppose the solution then is for
each record of the table, extract the contents of the 2 fields into two
seperate variables, then concatenate the two strings. Then the code you gave
me will work right?

This sounds like a looping structure, which will continue until it's
finished with all the records. Unfortunately, I have no experience doing this
in VB so I guess I'll have to look that up too.

Any additional help would be greatly appreciated.

-Blenvid

Klatuu said:
If you used it exactly as I posted it, you will get that error. Since I did
not know how you are getting your info out of your table, I could not be
exact. It is only an example to show how to concatenate two strings. This
standard concatenation technique works in almost all cases. Just substitue
the rst![path] and rst![filename] with whatever variables have the values you
need.

:

Hi Klatuu,

Thanks for your response.

I tried your code. I am getting a, "Runtime error, 424, Object Required"
error message. What could this mean?

-Blenvid

:

Application.FollowHyperlink rst![path] & rst![filename]

:

Hey all, and thanks for reading my question,

I've created a table called, [tbl_OtherReference]. One field in
[tbl_OtherReference] is a text field, called [fileName], which will hold the
name of a file with it's extension. For example, I'm using the file
"trial.xls" as my trial file. The second field, called [path], is the path to
this file. For "trial.xls", the path is simply, "C:\". (without the quotes of
course)

I'd like to combine these two fields on my form creating an active Hyperlink
to the specified document, most likely the hyperlink would be a button they
could push. For the example above, this would look like this now for the
hyperlink:

OnClick, go to here and open this file, [C:\trial.xls], just the way it's
supposed to. Only, I don't know the code.

Is this possible?

My boss indicated that he'd like the table [tbl_OtherReference] to be
completely editable. So, I'm thinking I'll create a subform in the form for
this table. The subform will be completely editable, and next to the subform
will be the buttons I'm talking about.

Thanks so much!

-Blenvid
 
G

Guest

Hi Klatuu,

Thanks again for your code. Unfortunately, it's not working and giving me
the same 424 error as before.

It looks like the code you gave me isn't applying to any buttons. This code,

----
Application.FollowHyperlink Me.txtPath & Me.txtFilename
----
works for the one "Go" button. Only thing is, if someone makes a new entry,
a new record, there will be another "Go" button which will need to have the
code above. Does this make better sense?

-Blenvid

Klatuu said:
If you want to spin through your table and do it for every record:
You may want to look in the VB Editor Help for Info on the FollowHyperlink
method. There are some other arguements that may be things you want to use.
Also, I am curious about doing this, because each iteration of the Do Loop
will either Open a File or go to a web site, depending on what the link it to.

Sub DoTheLinks
Dim dbf As Database 'variable for database object reference
Dim rst As Recordset 'varialbe for recordset object reference
Dim app As Applicationi 'variable for application object reference

set dbf = CurrentDb
set rst = dbf.OpenRecordset("tbl_OtherResources", dbOpenSnapshot)
If rst.RecordCount = 0 Then
MsgBox "No Records To Process", vbExclamation
Else
Do While Not rst.Eof
app.FollowHyperlink rst![path] & rst![filename]
rst.MoveNext
Loop
End If
rst.Close
set rst = Nothing
set dbf = Nothing
set app = Nothing
End Sub

Blenvid said:
Hi Klatuu,

I am getting the info. out of my [tbl_OtherResources] table with a subform.

I'm not very familiar with VB, but I have experience with C++ and Java, so I
know what you're saying about strings. I suppose the solution then is for
each record of the table, extract the contents of the 2 fields into two
seperate variables, then concatenate the two strings. Then the code you gave
me will work right?

This sounds like a looping structure, which will continue until it's
finished with all the records. Unfortunately, I have no experience doing this
in VB so I guess I'll have to look that up too.

Any additional help would be greatly appreciated.

-Blenvid

Klatuu said:
If you used it exactly as I posted it, you will get that error. Since I did
not know how you are getting your info out of your table, I could not be
exact. It is only an example to show how to concatenate two strings. This
standard concatenation technique works in almost all cases. Just substitue
the rst![path] and rst![filename] with whatever variables have the values you
need.

:

Hi Klatuu,

Thanks for your response.

I tried your code. I am getting a, "Runtime error, 424, Object Required"
error message. What could this mean?

-Blenvid

:

Application.FollowHyperlink rst![path] & rst![filename]

:

Hey all, and thanks for reading my question,

I've created a table called, [tbl_OtherReference]. One field in
[tbl_OtherReference] is a text field, called [fileName], which will hold the
name of a file with it's extension. For example, I'm using the file
"trial.xls" as my trial file. The second field, called [path], is the path to
this file. For "trial.xls", the path is simply, "C:\". (without the quotes of
course)

I'd like to combine these two fields on my form creating an active Hyperlink
to the specified document, most likely the hyperlink would be a button they
could push. For the example above, this would look like this now for the
hyperlink:

OnClick, go to here and open this file, [C:\trial.xls], just the way it's
supposed to. Only, I don't know the code.

Is this possible?

My boss indicated that he'd like the table [tbl_OtherReference] to be
completely editable. So, I'm thinking I'll create a subform in the form for
this table. The subform will be completely editable, and next to the subform
will be the buttons I'm talking about.

Thanks so much!

-Blenvid
 

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