473,804 Members | 3,549 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open a file specified in a field using Shell function

lwwhite
16 New Member
I'm working with VB in an Access 2003 database. I have a form, called "EditWindowsFie lds," that contains a field called "sourcedoc. " I am trying to use the Shell function to open the XML file that is specified in the "sourcedoc" field. I've created a button on the form with this as the OnClick event:

Shell "C:\Program Files\Adobe\Fra meMaker7.1\Fram eMaker.exe C:\Sourcedocs\M e.sourcedoc", vbNormalFocus

Needless to say, that's not working and I can't figure out how to call a file specified in a field rather than a hardcoded file name in this function. I'm not a programmer at all, just muddling my way through here. Can anyone help?
Dec 1 '06 #1
4 5978
NeoPa
32,579 Recognized Expert Moderator MVP
I'm working with VB in an Access 2003 database. I have a form, called "EditWindowsFie lds," that contains a field called "sourcedoc. " I am trying to use the Shell function to open the XML file that is specified in the "sourcedoc" field. I've created a button on the form with this as the OnClick event:

Shell "C:\Program Files\Adobe\Fra meMaker7.1\Fram eMaker.exe C:\Sourcedocs\M e.sourcedoc", vbNormalFocus

Needless to say, that's not working and I can't figure out how to call a file specified in a field rather than a hardcoded file name in this function. I'm not a programmer at all, just muddling my way through here. Can anyone help?
Expand|Select|Wrap|Line Numbers
  1. Shell "C:\Program Files\Adobe\FrameMaker7.1\FrameMaker.exe C:\Sourcedocs\" & Me.sourcedoc, vbNormalFocus
That should do it for you.
Dec 1 '06 #2
ADezii
8,834 Recognized Expert Expert
I'm working with VB in an Access 2003 database. I have a form, called "EditWindowsFie lds," that contains a field called "sourcedoc. " I am trying to use the Shell function to open the XML file that is specified in the "sourcedoc" field. I've created a button on the form with this as the OnClick event:

Shell "C:\Program Files\Adobe\Fra meMaker7.1\Fram eMaker.exe C:\Sourcedocs\M e.sourcedoc", vbNormalFocus

Needless to say, that's not working and I can't figure out how to call a file specified in a field rather than a hardcoded file name in this function. I'm not a programmer at all, just muddling my way through here. Can anyone help?
'Just remember that when using the Shell() function, that it returns a Variant
'(Double), thus you must use this syntax:
Expand|Select|Wrap|Line Numbers
  1. Dim RetVal
  2. RetVal = Shell("C:\WINDOWS\Regedit.exe", vbNormalFocus)
Dec 1 '06 #3
NeoPa
32,579 Recognized Expert Moderator MVP
'Just remember that when using the Shell() function, that it returns a Variant
'(Double), thus you must use this syntax:
Expand|Select|Wrap|Line Numbers
  1. Dim RetVal
  2. RetVal = Shell("C:\WINDOWS\Regedit.exe", vbNormalFocus)
Although that is certainly recommended (or use
Expand|Select|Wrap|Line Numbers
  1. Call Shell("C:\WINDOWS\Regedit.exe", vbNormalFocus)
), it is not actually necessary due to Access's propensity to be very (overly) forgiving in matters of code.
You can take it as a strong recommendation though, to use code which illustrates to any reader that it is a function rather than a simple subroutine procedure you're calling.
Dec 1 '06 #4
lwwhite
16 New Member
Expand|Select|Wrap|Line Numbers
  1. Shell "C:\Program Files\Adobe\FrameMaker7.1\FrameMaker.exe C:\Sourcedocs\" & Me.sourcedoc, vbNormalFocus
That should do it for you.
Perfect! Thank you so much!
Dec 1 '06 #5

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

Similar topics

1
1479
by: Brian Turner | last post by:
I have a filenane defined in a table in my database. This filename field is also displayed on my form. I have place a print button on my form. I would like to be abel to click the Print button on the form and print out the file defined in the filename field. How can I do this? I thought of using a DOS command on the Print button but not sure what that command is. Thanks in advance.
13
22641
by: Blue | last post by:
Hi , Can any one please let me explain me the diffrences between "open"/ "fopen" or "read"/"fread" or "write/fwrite". I know that "open" /"read" / "write" are system calls and "fopen" /"fread" / "fwrite" are normal library functions. May be internally must be calling "fopen" /"fread" / "fwrite" functions.
1
6511
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
4
15967
by: JonniP | last post by:
Hi Am using Call Shell("explorer.exe c:\", vbNormalFocus) this works fine however i have the folder location stored in a txt field and would like the button to retrieve that location Private Sub cmdShortcut_Click() Dim strShortcut As String strShortcut = Me.txtShortcut
5
2367
by: barnetod | last post by:
I am trying to open a text file designated by the user. Then I want to change all lower case values to capital letters. Then write file. I am stuck and can not change the characters or am not writing correctly. Please let me know what I can do to fix this.
0
5095
by: mix01 | last post by:
Hi, I am trying to get some VBA code working, but am preplex as to why it does not work. I would really appreciate any level of help. Many thanks, Mix01 Version of the program
0
2675
by: Ofelia | last post by:
Hi, I'm new to this forum and to Perl language but I would like to ask for your help. I'm working in Linux and the files I need to process are in the format “file.gz”. I created a script which should decompress, open and then delete nearly 400 files. To do so I use "open FILEPT, "zcat $filename|"". In the beginning the script works fine, but after about 300 files processed I get an error on Open function: “proc: Could not open file...
3
8156
by: BASSPU03 | last post by:
Private Sub FilePath_Click() Rem Me! Dim stAppName As String Dim stlink As String stlink = Me! stAppName = "C:\Program Files\Internet Explorer\IEXPLORE.EXE H:\Application\Cables\" + stlink Call Shell(stAppName, 1) End Sub After using the Common Dialog API to store a file name in a field "FilePath," I use the code above to click on FilePath to open the file associated with the file path. The...
5
5127
by: Ruben | last post by:
Hello, I am using the "Application.FollowHyperlink strFilePath, , True" line of code from within access forms to launch any file type I want (e.g., xls, doc, pdf, etc.). The files open up okay, but open up in the background. How do I make them open in front where they are visible? I have tried various things like "Appliction.Visible=True / False" and "Screen.ActiveControl.Visible=True / False" but have not been able to figure it out.
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9582
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10580
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9157
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7621
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.