Open And Excel File W/ Command Button?

Nov 3, 2006

I am trying to open a workbook with a command button on a form however the path to the file is giving me a fit. The path for the file location contains spaces and I am going blind trying to figure out how to rectify the path. Heres the line. I am sure someone here will see this problem quick! Thanks.

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stAppName As String

stAppName = "Excel.exe N:OPSCOMMONOpsResearchContact CenterDI CCL Reporting dBApps by Agent.xls"
Call Shell(stAppName, 1)

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

Heres the mess I made out of it:
stAppName = "Excel.exe N:OPSCOMMONOpsResearchContact" & Chr(32) & "CenterDI" & Chr(32) & "CCL" & Chr(32) & "Reporting" & Chr(32) & "dBApps" & Chr(32) & "by" & Chr(32) & "Agent.xls"""

:confused:

View Replies


ADVERTISEMENT

Command Button To Open Excel File

Nov 15, 2006

Is this possible? A command button when click will open an excel file... :rolleyes:

Cheers!
Sheila

View 5 Replies View Related

Open An Excel Workbook From A Command Button

Jun 17, 2005

I have a button on a form, to open Excel, I need to open the relevant file at the same time...


Dim oApp As Object

Set oApp = CreateObject("Excel.Application")
oApp.Visible = True


My file is located...C:ship info imeline.xls

any ideas please...

View 2 Replies View Related

General :: Open MX Excel Using A Command Button

Jan 15, 2014

I am trying to open MX Excel using a command button. I have tried using a hyperlink and various codes that i have found online with no luck. The Excel file is being used by Access as it bring data from the spreadsheet and displays it within a subform. (I think this is where the problem occurs) The subform displaying some data from Excel is working fine but when i click my hyperlinked button (To open the excel file) i am met with errors and the file will not open.

View 1 Replies View Related

Creating A Command Button To Open A File

Jun 13, 2006

I have set up a database that houses file locations. The form that I have made shows a job # and the files that correlate with it. I would like to set up a command button that will read the file name and open it in Excell. If any one know how to do this I would greatly appreciate the help.

View 3 Replies View Related

Command Button To Open 2 .CSV's In Multiple Tabs In Excel Workbook

Oct 10, 2006

I want to use command buttons to open two separate .csv files in the same excel workbook on different tabs. Is this possible?

View 4 Replies View Related

Forms :: Open A Specific PDF File Per Record With A Command Button

Apr 18, 2013

I need to open a specific pdf file per record by using a command button. The pdf files will all reside in a specific folder in a partition on my hard drive. Each pdf file will have a unique four digit file name e.g 1234.pdf.The file name will match a unique number allocated to each record. This number is generated by adding 1000 to the record ID.Record 10 will therefore have an associated pdf file name of 1010.pdf.I have created a text box field , named 'TestReportID', to capture the unique four digit number per record that I assume is needed to be referred to when setting up the code to find and display the correct related pdf file.

I have set up a command button on the records form and as simple test using the hyperlink address to the folder where the pdf files reside, I can open a pdf file by clicking on the command button but it does not matter what record is open when I click the command button, it will always open the same pdf file.If I don't identify a specific file name in the hyperlink address, when I click on the button it will display a file open dialog which lists all the relevant pdf files and I can then select and open the required file.I would like to cut out that step and get the correct file to open when I click the button.

View 2 Replies View Related

Opening A Password Protected Excel File From A Command Button In Access

Dec 22, 2006

Hi All,
I have three excel files (ActualHires.xls, ActualPromotions.xls and
ActualSeparation.xls). These are password protected files (with the
same password). They are linked to an access database and whenever the
files are opened, one must supply the password and click the 'Enable
automatic refresh button.' What I was wondering was if this could be
done in access with a command button. I have pasted some code below
that I found but now I'm getting an error.
This is the code:

Dim BookNames As Variant
Dim B As Long


BookNames = Array("O:ExcelFilesActualHires.xls",
"O:ExcelFilesActualPromotions.xls",
"O:ExcelFilesActualSeparations.xls")


For B = LBound(BookNames) To UBound(BookNames)
WorkBooks.Open FileName:=BookNames(B), _
UpdateLinks:=3, Password:="*******"
WorkBooks(B).Close SaveChanges:=False
Next B


But when I click the button, I get this error:
Run-time error '9' Subscript out of range.


and this line is highlighted:
WorkBooks(B).Close SaveChanges:=False


Any help would be greatly appreciated.


Thanks.

View 1 Replies View Related

Command Button To View PDF / Excel File Or JPEG From Object Within Database Table

Aug 12, 2013

I have created a database for a church cemetery. It contains the usual names, birthrates deaths, etc.... I have also created a map of the cemetery in PDF format with the lot number highlighted which is assigned to a particular record. I did the same in excel with a layout of the lot and a JPEG picture of the grave marker. In my table I created Three columns - Site Plan, Lot Plan, and Grave marker. I insert the specific site plan, lot plan, and jpeg picture using the "insert object" in the table. On my form after a search, I have created three buttons.. Site Plan, Lot Plan & Grave Marker.

I have looked and experimented trying to assign these command buttons to open these files on the form. I don't have any experience with macros or VB code.

View 4 Replies View Related

Command Button Open Image

Jan 29, 2005

Is it possible to have a cmdButton open a pre saved image from your hard drive. The images are saved with the same name as the Account Number. (ex: AcctNum -- TA123409 Image -- TA123409.bmp) I want the cmdButton to open the image filtered or based on the Account Number. If so, could someone show me a sample OnClick code. Thanks

View 7 Replies View Related

Command Button To Open Web Page.

Oct 26, 2004

Hello,

I would like to make a comand button in my form that will open a specific web page.
Can some one Help Me Please?

View 12 Replies View Related

Command Button To Open A PDF Form.

Apr 7, 2008

Dear All:

Does anyone know how to use a command button to open a Pdf form in access?

This Pdf form is on the "c" drive called "portfolio".

Thanking in advance,

Dion

View 14 Replies View Related

Using Command Button To Open Table

Aug 26, 2005

Dear All:

I would like to use a command button on a form to open a table. The name of the table is called "MAJORCODE"

Any suggestions?

Many thanks,

Dion

View 5 Replies View Related

Open New Form Command Button

Oct 11, 2006

I have a form with a drop down list that is coming from a query (City Query)

I have a command button to open a form for data entry to the City table -

When I open the form for city add a record - close the form.

I then go to the drop down list (city query) to select the record that was just added to the city table and the record is not in the query.

What do I need to do for the newly added record to show in the query drop down?

View 14 Replies View Related

Command Button To Open Attachments

Jun 18, 2012

I have created A command button (OK) on the form but can't figure out the code. My Scenario is:

1) I have 2 cascading combo boxes
2) I have a text field as attachment

What I want is to select the value from second combo box then I want to click command button to view the attachments instead of double clicking the attachment and also I wanna ask is there any way to modify the display view of attachments in access a part from paperclip and image icon.

View 1 Replies View Related

Command Button In Form To Open Certain Files

Mar 12, 2005

I have based a form on a parameter query, so that when the user is prompted to enter a 'Hobby' to search on, the relevant records will be displayed on the form.

Now, I have created a command button designed to open a template letter in MS Word for a particular hobby. The problem is, I need the command to open certain file depending upon the value input in the parameter box intially. How would I go about doing this?

View 1 Replies View Related

Command Button To Open Specific Record

Oct 6, 2004

Hi All,

I have a form called "frmProducts" which is linking to table "tblproducts".

Easy Enough...

The form shows all the Products information (fields).
I have a "More Info" command button (cmdMoreInfo) next to every record in the form.

When the command button is clicked I would like it to open up another form "frmMoreInfo".
But On frmMoreInfo I would only like it to show that specific product.

I have tried the following code on the on click event on the command button but it was always asking me for the value of Form![frmMoreInfo]![txtInternalCode]

Code:Private Sub Command12_Click()On Error GoTo Err_Command12_ClickDim stDocName As StringDim stLinkCriteria As StringstDocName = "frmMoreInfo" stLinkCriteria = "Form![frmMoreInfo]![txtInternalCode]=" & Me![txtInternalCode]DoCmd.OpenForm stDocName, , , stLinkCriteriaExit_Command12_Click:Exit SubErr_Command12_Click:MsgBox Err.DescriptionResume Exit_Command12_Click End Sub

Any Ideas?

View 4 Replies View Related

Command Button Open Up Hyperlink From A Recordset

Jan 3, 2005

Hello all, I hope your hollidays were great!!

Ok I have a Continuous form that in one of it's fields contains Hyperlinks. The form is named [Song Info] and the field is [Play].
I want this field to be hidden and have a command button open up the hyperlink in that recordset. I think that all the info need
but if not let me know.



Thanks
Rich M

View 11 Replies View Related

General :: Opening Excel With A Command Button?

Jul 12, 2013

I am trying to open MX Excel using a command button. I have tried using a hyperlink a various codes that i have found online with no luck. The Excel file is being used by the Access as it bring data from the spreadsheet a displays it within a subform. (I think this is where the problem occurs) The subform displaying some data from Excel is working fine but when i click my hyperlinked button i am met with errors and the file will not open.

View 6 Replies View Related

Exporting A Report To Excel Using Command Button And VBA

Nov 28, 2012

What would the VBA command line look like to export a report to Excel using a command button ?

View 3 Replies View Related

Forms :: Opening PDF File From Button Command

Aug 19, 2015

I would like to open a PDF document using a button control on a form to a file path listed in a field on the form (Me.Link). I am trying to use the followHyperlink code but I keep getting the runtime 490 error.

This is the code im using:

Dim strFilePath As String
strFilePath = Me.Link
Application.FollowHyperlink (strFilePath)

If I put a filepath to one of the pdf documents in the place of (strFilePath) it opens that pdf document fine but not when I declare a filepath based on the one listed on the form.

View 8 Replies View Related

Import Data Into Table From Excel Using Command Button

May 18, 2006

I'm looking for someone to help me with a solution to my problem of importing data into a data table.
What I'd like to do is have a command button on a form. When this button is clicked the records in a table are cleared out. Then I'd like for a browse window to come up to locate an Excel file. The user would select this file and the data would be imported into the data table that was just cleared.
Can this be done without too much trouble?

Thanks, Paul

View 4 Replies View Related

Modules & VBA :: Import Excel Document Via Command Button

Mar 4, 2014

I have managed to export the data that I want into a spreadsheet using a command button.

Once my colleagues have completed the spreadsheet, I need a command button on a form with a file search dialogue box which will allow them to transfer the spreadsheet back into the database - updating the relevant records rather that over writing them.

Is there a VB code/Macro I can use which will allow me to do this?

View 2 Replies View Related

Forms :: Open Word Document Via Access Command Button

Feb 4, 2014

I am creating a database. I have all my forms, queries, tables, reports just as I need them. However, I would like to have a command button on my switchboard that will pull from a query to feed to a Word document (that's actually a letter on my company letterhead). I know a Macro has to be involved with this, but again, I have little to no knowledge of Macros. Also, I would like to be prompted to enter a client ID number when I click on this command button (because I only want to print a letter for a new client, not all of them).

View 4 Replies View Related

Forms :: Command Button To Open Datasheet Of Contact Names

Dec 5, 2013

I am trying to add a command button to my main menu to open the contact names as a datasheet, I have changed the properties on the contact names form to datasheet as well as changing the properties on the button to the below:

Private Sub Command48_Click()
DoCmd.OpenForm "Contact Names", acFormDS
End Sub

at first after I saved it, the button did nothing. Now after a bit of playing around (probably not a good idea) I have a new message that states:"The expression On Click you entered as the event property setting produced the following error: Ambiguous name detected: Contacts_Click.To add some additional information, in the vba sheet above the code i wrote above it says:

Option Compare Database
Private Sub Contacts_Click()
DoCmd.OpenForm "Contact Names", acFormDS
End Sub

Private Sub Contacts_Click()
DoCmd.OpenForm "Contact Names", acFormDS
End Sub

should I delete this?

View 5 Replies View Related

Reports :: Using Command Button In A Form To Filter And Open A Report?

Jun 26, 2014

I'm trying to use a command button in a form to filter and open a report. I am able to get it to open the report, but I cannot get it to filter the report based on a combobox in the form. I've tried every combination of code I could think of and find. Here is what I currently have:

Code:
Private Sub FilterReport_Click()
DoCmd.OpenReport "Report", acViewReport, "First Name='" & Me.FName & "'"
End Sub

Code:
Option Compare Database
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = Me.FName
End Sub

"FilterReport" = Form Button
"Report" = Report
"First Name" = Report Field
"FName" = Form Combo Box

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved