access-vba

Excel.Application Object .Quit leaves EXCEL.EXE running

拜拜、爱过 提交于 2019-12-30 11:24:06
问题 I'm working within MS Access 2013 on Windows 10 and I'm simply trying to write a Sub that opens an Excel file on disk, changes the column formatting and some columns, saves and quits. The Sub runs and does as intended, but the problem is that even after the .Quit command, "EXCEL.EXE" keeps running and subsequent calls to that Sub will result in run-time errors. If I close Access after running the sub, "EXCEL.EXE" disappears on the Task Manager, but not if I do "Compact and Repair" the

Only user-defined type defined in public object modules can be coerced when trying to call an external VBA function

蹲街弑〆低调 提交于 2019-12-30 09:45:15
问题 I am trying to call an Access function from Excel and get this error: Compile Error: Only user-defined types defined in public object modules can be coerced to or from a variant or passed to late-bound functions. I tried to adopt this solution I found, but with no luck. Here is my code: In the Excel Module ExternalStatistics Option Explicit Public Type MyExternalStatistics esMyInvites As Single esMyInvitePerTalk As Single End Type Public MyExtRecStats As MyExternalStatistics In the Sheet1(A

copy formatted text into access using vba

爷,独闯天下 提交于 2019-12-30 08:33:31
问题 I need to save formatted text from Word in an Access Database. So far I've managed to figure out how to store formatted text in an Access Field (Create a Memo Field in a Table and set the Text Format as Rich Text). Searching SO I have not yet come across a solution as to how to transport said text from word into Access. I know that it is possible, because you can do it by simply copying and pasting the information if you are doing it manually. My question, how can I copy formatted text from

Change Navigation pane group in access through vba

此生再无相见时 提交于 2019-12-30 05:12:06
问题 I have a module of VBA code in access that creates 4 new tables and adds them to the database. I would like to add in a part at the end where they are organized in the navigation pane through custom groups so that way they are all organized. Would this be possible through vba? EDIT: I don't want the tables to be in the unassigned objects group. I want to change the name of that group through VBA. 回答1: EDIT: Added more code to add other object types to the custom Nav group. The following code

Making “DoCmd.GoToRecord” function work on a subform

核能气质少年 提交于 2019-12-30 04:10:23
问题 I have been using the function DoCmd.GoToRecord , , acNewRec successfully for creating and moving to a new record within a subform (with a table as the source). However, when I try to do the same from the parent form, this does not work. I have tried different approaches, including: Me.sbfrm_subform.Controls("ctrName").SetFocus DoCmd.GoToRecord , , acNewRec which only sets the focus on the control (ctrName), but fails to add and go to a new record, or DoCmd.GoToRecord acDataForm, Me.sbfrm

How to filter by what the user enters in a textbox, except show all if it's empty

那年仲夏 提交于 2019-12-29 09:51:28
问题 I want to filter a form with a query, so that the user has to input what he would like to search in a textbox and it gets filtered out. There are some empty fields, and these should show if the user has not searched for anything yet, but if he searches those should not be shown anymore. With this code, the searching works, but it shows the empty fields: Like("*" & [Forms].[BerichtSuche].[efTitle] & "*") OR Is Null I tried this, but then nothing at all is shown: If(Len([Forms].[BerichtSuche].

Is there a way to write to/edit a otherwise read-only Recordset for the context of the form and work with the data?

可紊 提交于 2019-12-29 09:21:12
问题 In my database there is a form that displays records filtered by an abbreviation you can choose from in a combo box. Now in some cases I will want to open another form with the same records as displayed before, but this time there need to be two extra columns and the records (specifically the two new columns) have to be editable. So far my approach looks like this: I fetch the data from the previous form, put it in a new Recordset and add the two columns. Looks as follows: Dim cpRS As New

Active X Error With Excel 2016 And Late Binding

独自空忆成欢 提交于 2019-12-29 09:14:53
问题 I have Microsoft Office 365 Business installed on my PC and am attempting to run Access VBA to create an Excel Object. This is my Access VBA syntax I am using Dim xl As Object, wb As Object, ws As Object, ch As Object Set xl = CreateObject("Excel.Application") However, it hits the CreateObject line and throws the image below, but ONLY on my PC running Office 365 Business. If I run this same syntax on a computer running Office 2010 it executes exactly as it should and creates the Excel Object

Operation must use an updatable query. (Error 3073) Microsoft Access

删除回忆录丶 提交于 2019-12-29 09:12:29
问题 I have written this query: UPDATE tbl_stock1 SET tbl_stock1.weight1 = ( select (b.weight1 - c.weight_in_gram) as temp from tbl_stock1 as b, tbl_sales_item as c where b.item_submodel_id = c.item_submodel_id and b.item_submodel_id = tbl_stock1.item_submodel_id and b.status <> 'D' and c.status <> 'D' ), tbl_stock1.qty1 = ( select (b.qty1 - c.qty) as temp1 from tbl_stock1 as b, tbl_sales_item as c where b.item_submodel_id = c.item_submodel_id and b.item_submodel_id = tbl_stock1.item_submodel_id

Passing Query Parameter to Sub-Report

你说的曾经没有我的故事 提交于 2019-12-29 08:54:08
问题 It has been a long time since I have worked with MS Access and am not sure if I am doing this right. I have a Report bound to a query of single list of user names. The report groups on the user name and has a sub-report in the detail that is a chart. The sub-report/chart is based on a query that accepts a parameter of the user name. Since the sub report is not bound I need to pass the user name parameter from the main report detail onload event down to the sub-report and thus into the