ms-access

Interop with Microsoft Access does not interact with User's session

ε祈祈猫儿з 提交于 2021-02-04 21:16:18
问题 I am injecting a piece of VBA code into a Microsoft Access database from .Net. It is just a single line of code, which runs a Macro. All the Macro does is run a block of VBA code inside a module. The issue I am having is that this all happens in a new MSAccess session, which I can't even see, instead of the session the user currently has open. Is it possible to, instead, have this interact with the users current MSAccess session? The whole point of this is to open a particular form inside the

Data type equivalents: MS Access Tables ↔ 'CREATE TABLE' Queries ↔ ODBC SQL

和自甴很熟 提交于 2021-02-04 14:16:38
问题 What is the correct syntax when creating a table in Access with SQL? I have tried DECIMAL, DOUBLE, NUMBER, INT... nothing lets me create an integer category with limiters. Example: CREATE TABLE NONGAME ( ITEM_NUM CHAR(4) NOT NULL PRIMARY KEY, DESCRIPTION CHAR(30), ON_HAND NUMBER(4), <------- DOES NOT WORK! CATEGORY CHAR(3), PRICE DECIMAL(6,2), <------- DOES NOT WORK! ANYTHING DOUBLE(4,2) <------- DOES NOT WORK! ); 回答1: MICROSOFT ACCESS DATA TYPES The following table shows the Microsoft Access

How to write a Add-in for the development enviroment: “Microsoft Visual Basic for Applications”

寵の児 提交于 2021-02-04 08:30:06
问题 I want to write a Add-In for the development enviroment: "Microsoft Visual Basic for Applications" which I have to use. I want to add some convenience functions. Unfortunately I cant find anything about this because as soon as I search for "Microsoft Visual Basic for Applications" or "Add-In" it tells me how to write Add-in with VBA. But I want to know how I write a Add-In in any language (if possible everything else but vba) for the development enviroment: "Microsoft Visual Basic for

Select top N rows for each group

回眸只為那壹抹淺笑 提交于 2021-02-04 08:25:12
问题 I have the following MS Access DB schema: I want to select rows from Items table ordered by Items.score so that there are at most Group.top_count rows for each group. For example I have the following data in the tables: Group table: Items table: I want to select top 2 items for group #1 and top 1 item for group #2. So the result must contain rows 1, 2 and 5. There was a similar question at DBA stackexchange, but about SQL Server. So all answers used SQL Server syntax and I couldn't adapt it

How to use VBA variable for IN 'SourceDB' clause of MS-ACCESS query

半城伤御伤魂 提交于 2021-02-04 08:22:28
问题 I am trying to pass a vba string variable to an IN clause of a SQL statement in the query builder view. the string is created by the following function: Public Function GetBackEnd() If Len(GetBackEnd) = 0 Then GetBackEnd = BackEnd End Function backend itself is derived from a dropdown box in userform, there are two entries in a table with two different addresses, one each for the live and developement DB's. The dropdown box sets the "environment" variable upon selection. Property Get BackEnd(

MS Access Restart Number Sequence

你。 提交于 2021-02-04 06:51:33
问题 trying to do a sequence count in MS Access where the count sequence resets based on another field, so example below, trying to figure out ColB : ColA ColB 4566 1 5677 1 5677 2 5677 3 8766 1 8766 2 1223 1 Think it might have something to do with the DCount() function, unsure. Would very much appreciate the help ... Thanks! 回答1: Calculating a group sequence number in Access query is fairly common topic. Requires a unique identifier field, autonumber should serve. Using DCount(): SELECT *,

Quartile/Percentile in MS Access via SQL with a GROUP BY when some values can be NULL

别来无恙 提交于 2021-02-02 09:53:50
问题 I am looking to calculate a percentile of a subgroup for a field that can be NULL. Field IU is either 1 or Null. Specifically: *my table: tblFirst250 *group by: IU = 1 (which is Nullable) *percentile of: GM (which is Nullable) I am starting with the following (but I am open to better ways of doing this): select T.groupField, 0.75*(select max(myField) from myTable where myTable.myField in (select top 25 percent myField from myTable where myTable.groupField = T.groupField order by myField)) + 0

ACCESS/SQL Combining multiple rows with one column into one row and creating multiple columns

半城伤御伤魂 提交于 2021-02-02 03:46:30
问题 I've looked at quite a few examples and nothing fits quite like I need it to. I have a table that has item numbers in one column and image links in another column. The issue I have is I need to combine rows that have the same item number but need to move the data in the HTML_LINK column to multiple columns called imagelink1, imagelink2, imagelink3. The max amount of imagelink columns I will need is 5. I tried a pivot table which worked to combine the rows, but it creates a column the name of

ACCESS/SQL Combining multiple rows with one column into one row and creating multiple columns

此生再无相见时 提交于 2021-02-02 03:44:04
问题 I've looked at quite a few examples and nothing fits quite like I need it to. I have a table that has item numbers in one column and image links in another column. The issue I have is I need to combine rows that have the same item number but need to move the data in the HTML_LINK column to multiple columns called imagelink1, imagelink2, imagelink3. The max amount of imagelink columns I will need is 5. I tried a pivot table which worked to combine the rows, but it creates a column the name of

SQL: Selecting multiple fields with one unique field based on most recent date

谁说我不能喝 提交于 2021-01-29 19:37:09
问题 I'm attempting to write an SQL statement to select a unique part number based on the most recent date. If I have just the two fields PartNo and ReceiveDate I could do: "SELECT PartNo, Max(ReceiveDate) FROM Table GROUP BY PartNo;" and this would return the unique PartNo and the most recent date. The problem is that I also want to include the fields VendorName and Qty (But I just want PartNo to be unique). I've tried: "SELECT PartNo, VendorName, Qty, Max(ReceiveDate) FROM Table GROUP BY PartNo;