I want to create a command button on a form that will populate a certain field in a certain table for that record with a hyperlink address (just the text) and add another field from that record to the string. For Example:
On Click, fill the field [DRAWING HYPERLINK] in the Table "ASSEMBLY" with W:\engineering\PRODUCT ENGINEERING\ASSEMBLY\PDF\ [field data from record].pdf
field data from record entitled [ASSY DOC]
The data in that field is A-2000-1
So the DRAWING HYPERLINK field in Table ASSEMBLY would have this data in it:
W:\engineering\PRODUCT ENGINEERING\ASSEMBLY\PDF\ A-2000-1.pdf
Just by Clicking the command button on the form.
I think this would be simple, but I am having trouble. Any help is greatly appreciated.
Thanks
13 2099 @Desitech
Hi,
By "field data from record entitled [ASSY DOC]" do you mean that [ASSY DOC] is the name of a field in another table and that that field contains the data "A-2000-1" in the record which is showing on the form when you click the button you want to code?
If that is the case, I think you are correct that this should be fairly simple, but I'll wait for confirmation.
Jim
Yes, but not in another table. The Form I am using is entitled FrmAssembly that is linked to a table entiled TblAssembly
[ASSY DOC] is the title of one of the fields in the same table
Fields in table looks like this:
DOCID ASSY DOC DESCRIPTION DATE BY DRAWINGHYPERLINK
Data in record looks like this:
DOCID =1
ASSY DOC= A-2000-1
DESCRIPTION = DH Assembly
DATE = 1/1/09
BY = DBT
DRAWING HYPERLINK = W:\engineering\PRODUCTENGINEERING\ASSEMBLY\PDF\ A-2000-1.pdf
@Desitech
Even easier. Don't do it! If the text before and after the data in [ASSY DOC] is fixed, then it does not need to be stored in the table. Any time you need to use the full string you just build it up. eg. - strDrawing_Hyperlink = "W:\engineering\PRODUCTENGINEERING\ASSEMBLY\PDF\ " & Me.txtAssyDoc.Value & ".pdf"
assuming that txtAssyDoc is a text control on your form which holds tblAssembly.[ASSY DOC] for the required record.
Jim
That must be close. I am not getting any error messages, but the command is not populating the DRAWING HYPERLINK field.
I also need to populate the DRAWING HYPERLINK Field because I have another command button looking at the field to launch the hyperlink.
@Desitech
It's not supposed to. You don't need that field. All the information is already either (1) stored in your table or (2) known and fixed.
When you need to use the fixed data and the stored data to do something (eg open the pdf file) you build the whole string by concatenating the known data with the stored data and then use that string to, again for example, open the file.
Jim
@Desitech
We're a little out of synch here, but no worries!
Forget the first button and have the second button build the string I talked about before and use that string to execute the hyperlink.
Jim
So are you saying with that line of code you sent, all I have to do is click on the command button and it will open that file I am looking for? If so, Then StrDrawing_Hyperlink must be wrong, because The Drawing Hyperlink fields are blank. The Code is not doing anything when I click on the command button.
@Desitech
No, sorry, let's back up a little. The code in your button would be something like - Private Sub btnYourButton_Click()
-
Dim strHyperlink As String
-
strHyperlink = "W:\engineering\PRODUCTENGINEERING\ASSEMBLY\PDF\ " & Me.txtAssyDoc.Value & ".pdf"
-
Application.FollowHyperlink strHyperlink, , True
-
End Sub
-
The concept is that you don't have to store what ends up as the string strHyperlink in your table because you can build it from the data that is stored there.
Is that making sense? It's half past three in the morning here and I may well be gibbering!
Jim
Yes that makes sence. But when I run the code, it doesn't like this line:
Application.FollowHyperlink strHyperlink, , True
@Desitech
Add the following lines - Private Sub btnYourButton_Click()
-
Dim strHyperlink As String
-
strHyperlink = "W:\engineering\PRODUCTENGINEERING\ASSEMBLY\PDF\ " & Me.txtAssyDoc.Value & ".pdf"
-
- Debug.Print strHyperlink
-
Stop
-
-
Application.FollowHyperlink strHyperlink, , True
-
End Sub
Now when you click on the button, the code will stop after it has printed the value of strHyperlink to the Immediate Window (if you can't see the Immediate Window down the bottom of the Visual Basic window, either press <Ctrl>-G or click on View --> Immediate Window).
Check the value of strHyperlink as it is printed in the Immediate Window. I suspect that
A) there is an extra space in there between PDF\ and the value. I wasn't sure if you meant it to be a space, or
B) the whole string is not a "followable" hyperlink, and if you want to open a .pdf file, we have to do it another way. I'll think on that for a while.
Jim
Yes...That's all it was was a space....It work...Ya Hooo!!!!!!
THANKS FOR ALL YOUR HELP !!!!
@Desitech
Absolutely my pleasure. Moral of the story - don't store stuff you don't need to!
Have a good weekend
Jim
eta: I've still got it!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tryfon Gavriel |
last post by:
Hi all
I recently noticed when trying to optimise a major query of a chess website
I am the webmaster of, that adding an order by for "gamenumber" which is a
clustered index field as in for...
|
by: Bobbak |
last post by:
Hello All,
I have these tables (lets call it ‘EmpCalls', ‘EmpOrders', and
‘Stats') that each contain the list of EmployeeIDs, I want to be able
to create a Module in which I could call in my VB...
|
by: Robin S. |
last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope
I've done a better job of explaining myself below.
I am trying to produce a form to add products to a table (new...
|
by: GL |
last post by:
Hi,
Is there a way to add a field to an existing table using a query of
some sort (without needing to manually add a field to the table). I
know how to do it with a make table query, but I have...
|
by: Jim Heavey |
last post by:
Trying to figure out the technique which should be used
to add rows to a datagrid. I am thinking that I would
want an "Add" button on the footer, but I am not quite
sure how to do that. Is that...
|
by: Bryan |
last post by:
hello all...
im trying to add a record to an sql db on ms sql server 2000, using vb.net.
seems to be working.. except for one thing, one of the columns in the
database is a bit datatype, and...
|
by: Art |
last post by:
Hi everyone
I was hoping someone might be able to help me with this. I'm just starting to try to work with MS Access tables through VB.net. In Access I can take an existing table and add a new...
|
by: sellcraig |
last post by:
Microsoft access
2 tables
table "data main" contains a field called "code"
table "ddw1" is created from a make table query of "data main"
Goal-
the data in "code" field in needs to...
|
by: dympna |
last post by:
Hi can anyone suggest a fix for this... as I am a novice in access.
I have created a training table with the following fields
Employee Name - joe
Training Received - Fork lift
Date Received...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |