473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

click a button in form which opens a doc specific to that record

6
Hey,

I was looking for some help re: the following- what i want to achieve is to click a button on a form which opens a document specific to the open record. The form is entitled 'employees' and i wish to open the cv of the employee whos record is open.

(Eg- if i had John Smith's record open, the path to the CV for John Smith is c:\me\desktop\Smith, John\cv.rtf)

Thank you for your time!!

Col
Oct 27 '06 #1
6 1487
pks00
280 Expert 100+
If what u are saying is the folder name is Surname comma Forename
How is the name displayed on the form currently?

If u had seperate fields u could try this

FollowHyperlink "C:\me\desktop\" & Me.surname & ", " & Me.Forename & "\cv.rtf"
Oct 27 '06 #2
col
6
PKS,

Thanks for getting back to me so promptly!! The data is stored as 2 separate fields in the form SURNAME and FIRSTNAME. The folder name is surname,forename- but i can change it all to surname if that makes it more likely to work.

I could not manage to get the solution you suggested working. Am i suppose to paste this into the hyperlink box, within properties of the button? If so, then no joy as yet. Also, as a newbie, i am assuming that the 'Me' you quote next to surname and forename should be replaced with the name of my form?

Thanks again,
Col
Oct 27 '06 #3
Tanis
143 100+
Unless me.surname and me.forename are filenames, then I'm afraid it won't work. FollowHyperlink works on path names. May I suggest a slightly different approach. You can still use the FollowHyerlink method as that is probably the simplest. Firstly,create a table with the following fields. CVID, autonumber CVPath,hyperlink Surname, text and Forename, text. In the CVPath field put the pathname to the file. e.g. C:\word\johnsmithcv.rtf On your employee form. add a command button. Behind the command button add this code.

Application.FollowHyperlink Me.CVPath, , True

Where CVPath is the name of your text box that holds the pathname. Me just refers to the control. Now when you click the button it should open at the correct document. Incidentally, you could use a combo box for the hyperlinks.
Oct 27 '06 #4
col
6
Thanks for your help and advice!!

Im still a little confused. i dont understand how access would differentiate between which doc i wished to open. if i set the pathname as c:\...\...\johnsmith.rtf then surely only john smiths cv would be available.

Also, in which box of the table must i paste the pathname and does it have to be a new table or can it be the one i have been using to create the form?

Lastly, re: the Application.FollowHyperlink Me.CVPath, , True command- where exactly do i enter this?

Thanks again,

Col
Oct 27 '06 #5
pks00
280 Expert 100+
PKS,

Thanks for getting back to me so promptly!! The data is stored as 2 separate fields in the form SURNAME and FIRSTNAME. The folder name is surname,forename- but i can change it all to surname if that makes it more likely to work.

I could not manage to get the solution you suggested working. Am i suppose to paste this into the hyperlink box, within properties of the button? If so, then no joy as yet. Also, as a newbie, i am assuming that the 'Me' you quote next to surname and forename should be replaced with the name of my form?

Thanks again,
Col

ok, two seperate fields no problem
folder name is surname,forename - is there a space in between? The worry here is if u had two different people with the same name. I would recommened u use a primary key, does your table have a autonumber or something?

say u had a btn called cmdOpen, u then use the click event
e.g.

private sub cmdOpen_Click()

Dim sParentDir as String
Dim sUserDir as String

sParentDir = "C:\me\desktop\" 'best to define this as constant
sUserDir = Me.Surname & "," & Me.Forename 'best to use ID here


FollowHyperlink sParentDir & sUserDir & "\cv.rtf"
end sub



The use of Me means u are going to use a method or property of the form
in this case the two controls that hold the name

type . after Me then u get the intellisense menu
Here u can see your 2 fields

Me.
Oct 27 '06 #6
col
6
It worked!! thank you very much for your help. much appreciated!!

Col
Oct 30 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Robert Neville | last post by:
I am having some trouble with some old code revolving around custom form navigation buttons. My main form has a sub-form with these custom navigation buttons. In other words, the code should be...
6
by: Sally | last post by:
I need to be able to click in a subform and run code but at the same time I need to be able to scroll the records without running the code. I tried coding the Enter event of the subform control but...
3
by: Randy | last post by:
I have been able to set up a Find Record Button on my switchboard to take me to a form with the correct case number by using a parameter query and macro. When I try to run the Find Record button...
2
by: Jpipher | last post by:
Let me explain what I am trying to accomplish... Two forms -- we'll call them "Main" and "Related" A command button on "Main" runs a union query. The union query results are shown in "Related"...
3
by: kev | last post by:
Hi folks, I have a form for registration (frmRegistration) whereby i have two buttons. One is Save which saves record using the OnClick property. I used wizard to create the save button. The...
8
by: =?Utf-8?B?UmljaA==?= | last post by:
My from contains a "Move Next" button. When the user clicks on the "Move Next" button - several procedures get invoked and eventually, the dataset underlying the form will display main data from...
1
by: rdsandy | last post by:
Hi, Im using Access 2003. I have a form, with two buttons and a list box. When a user selects an item in the list box, the user clicks on one of the buttons which opens up the selected record. ...
1
Walt in Decatur
by: Walt in Decatur | last post by:
I have a database I'm using to build information about a laboratory building design. After I create a record for a space and input general info, I move to a subform where I'd like to record any...
7
by: onyris | last post by:
Hi guys, have a form which displays all the records i have in my database , and a search box for the user to search for a specific one . On the search button, i run a macro which opens another...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.