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.
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
How to modify an existing database template to meet my needs.
I am trying to create a command button that sits on the order details page and that will open up a report i have created called 'picklist' which is basically the same as an invoice but with some different product information listed on it.
I want the command button to open up the picklist that corresponds to the order that i am on e.g picklist #2 for invoice#2
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 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 am trying to create a command button that sits on the order details page and that will open up a report i have created called 'picklist' which is basically the same as an invoice but with some different product information listed on it.
I want the command button to open up the picklist that corresponds to the order that i am on e.g picklist #2 for invoice#2
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 working on supporting spaces in the DB filename. I got the rest of my program working... other than being able to invoke Access with the specified filename for it to open.
Code: C:Documents and Settingsc_mlueckMy DocumentsFandango>"C:Program FilesMicrosoft OfficeOffice12MSACCESS.EXE" "Schema Ideas.accdb"
C:Documents and Settingsc_mlueckMy DocumentsFandango>dir "Schema Ideas.accdb" Volume in drive C has no label. Volume Serial Number is C8E4-5856
Directory of C:Documents and Settingsc_mlueckMy DocumentsFandango
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'm trying to design a command button on a Form so the user can import the contents of an Excel spreadsheet to an existing Table in Access with the click of a button. But, i'd like the imported data to overwrite the existing data in the Table and not append to it. I've considered using linked tables but apparently you can't set Primary Keys when you do it this way.
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.
I need Access to open an Excel file prior to pulling information from it, because the Excel file itself only updates when it is opened. I was able to achieve this with the code below:
Quote:
'Opens a hidden Excel window. Dim app As New Excel.Application app.Visible = False Dim book As Excel.Workbook Set book = app.Workbooks.Open("S:OperationsAssistantDataba sesBUSES.xlsx")
[code]....
This works fine if NO Excel window is already open, but if the user happens to have some file open in Excel already, my code doesn't seem to work right. The file does not open in a hidden window. Instead, it opens in the window already open, and additionally, the file is not closed afterward, which leaves the user wondering where the hell this random file came from, and they have to close it. I need this Excel file to open, but I want it to be completely hidden from the user.
In my database I have a field with contents I want to copy and then paste into Excel. Whilst in development, I've made sure the field is visible so that I can see when it has any content. I have placed a button next to the field that copies its content to the clipboard. This works fine and can be confirmed if I open Notepad and paste the content into it with no issues.
The problem starts when I open Excel. I've tried opening it using another button and manually and the same thing happens when I try and paste the clipboard content into it. It's empty! I can't even directly paste into Notepad once Excel has opened. However, if I go back to the database with Excel already open in the background, I can hit my copy button and the content pastes into Excel with no issues. This proves my code is fine.
I have have a form with 4 subforms in it, one of the subforms is based on a filtered query . For a reason I can not work out I cannot get it to requery when I add a new record.
To add a new record I select from a combo box and use a command button to save the record
I have tried using this in the buttons on click event
I have a form. and it has three buttons. Such as Submit, Reject, Under Observation.
I want : 1) If i click SUBMIT button it will be disable and other two buttons REJECT and UNDER OBSERVATION will be enable 2) If i click REJECT button it will be disable and other two buttons SUBMIT and UNDER OBSERVATION will be enable 3) If i click UNDER OBSERVATION button it will be disable and other two buttons SUBMIT and REJECT will be enable
I am using access 2010 and I created couple of buttons on my forms that do some stuff in vba, but beside triger them with mouse I would also like my users to be able to have shortcuts on keyboard so for example I have btnClose an I widh when user press ALT + that btnClose do the same thing as it is doing when you press mouse on it.
I have a macro that Runs from a button that I attached to a form called " plans" the macro opens up a Dialog form from which I select a drawing number from, on selection of that drawing number a query is run and finds the information I want
The problem I am having is when I close the query the macro button goes active so if I want to run another query using the button it goes to the last record I selected. I have tried the refresh command but that does not work..I really need the button not to be active when the query is closed.
:rolleyes: Hi this is my first time using this forum, I hope someone can help. I have a form 1 and I want to open another form to display data specific to the record showing in form 1.
I have done this many times successfully but now I am getting an error msg "The sepcified field '[UnitID]' could refer to more than one table listed in the FROM clause of your SQL statement.
I have tried everything but cannot solve this one. Any suggestions?
After inputting data into a text box on a form i want to click on a command button which will open an email program and then put the text there so i can send it.
I have two tables, one is GENETIC and the other one is BoneSampleDNAprofile. Both tables have the field CY-Code. I want to create small form with 2 text box fields and one command button on the form to be able to insert CY-Code from the table GENETIC to designated DNA_LAB_Code in the table BoneSampleDNAprofile.
In that small form I would type DNA_LAB_Code and CY-Code where after pressing command button will insert CY-Code for the designated DNA_LAB_Code. This is continuous process after our Laboratory receive results from DNA laboratory. I have attached two .png files which are example of two tables.