473,405 Members | 2,404 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,405 software developers and data experts.

Adding Data to a Field

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
Apr 17 '09 #1
13 2099
JustJim
407 Expert 256MB
@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
Apr 17 '09 #2
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
Apr 17 '09 #3
JustJim
407 Expert 256MB
@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.
Expand|Select|Wrap|Line Numbers
  1. 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
Apr 17 '09 #4
That must be close. I am not getting any error messages, but the command is not populating the DRAWING HYPERLINK field.
Apr 17 '09 #5
I also need to populate the DRAWING HYPERLINK Field because I have another command button looking at the field to launch the hyperlink.
Apr 17 '09 #6
JustJim
407 Expert 256MB
@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
Apr 17 '09 #7
JustJim
407 Expert 256MB
@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
Apr 17 '09 #8
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.
Apr 17 '09 #9
JustJim
407 Expert 256MB
@Desitech
No, sorry, let's back up a little. The code in your button would be something like
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnYourButton_Click()
  2. Dim strHyperlink As String
  3. strHyperlink = "W:\engineering\PRODUCTENGINEERING\ASSEMBLY\PDF\ " & Me.txtAssyDoc.Value & ".pdf"
  4. Application.FollowHyperlink strHyperlink, , True
  5. End Sub
  6.  
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
Apr 17 '09 #10
Yes that makes sence. But when I run the code, it doesn't like this line:

Application.FollowHyperlink strHyperlink, , True
Apr 17 '09 #11
JustJim
407 Expert 256MB
@Desitech
Add the following lines
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnYourButton_Click()
  2. Dim strHyperlink As String
  3. strHyperlink = "W:\engineering\PRODUCTENGINEERING\ASSEMBLY\PDF\ " & Me.txtAssyDoc.Value & ".pdf"
  4.  
  5. Debug.Print strHyperlink
  6. Stop
  7.  
  8. Application.FollowHyperlink strHyperlink, , True
  9. 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
Apr 17 '09 #12
Yes...That's all it was was a space....It work...Ya Hooo!!!!!!

THANKS FOR ALL YOUR HELP !!!!
Apr 17 '09 #13
JustJim
407 Expert 256MB
@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!
Apr 17 '09 #14

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

Similar topics

4
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...
11
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...
6
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...
3
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...
3
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...
20
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...
12
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...
9
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
agi2029
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,...

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.