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
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.
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.
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.
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:
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
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.
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
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.
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?
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
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.
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.
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.
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?
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?
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).
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
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