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

Open a file specified in a field using Shell function

lwwhite
16
I'm working with VB in an Access 2003 database. I have a form, called "EditWindowsFields," 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\FrameMaker7.1\FrameMaker.exe C:\Sourcedocs\Me.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 5958
NeoPa
32,556 Expert Mod 16PB
I'm working with VB in an Access 2003 database. I have a form, called "EditWindowsFields," 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\FrameMaker7.1\FrameMaker.exe C:\Sourcedocs\Me.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 Expert 8TB
I'm working with VB in an Access 2003 database. I have a form, called "EditWindowsFields," 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\FrameMaker7.1\FrameMaker.exe C:\Sourcedocs\Me.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,556 Expert Mod 16PB
'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
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
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...
13
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"...
1
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"...
4
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...
5
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...
0
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
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...
3
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...
5
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
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...
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,...
0
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...

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.