AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题

问题[ms-access-2016](dba)

Martin Hope
Kiran Chapidi
Asked: 2020-04-23 09:04:56 +0800 CST

如何使用 MS Access Query 创建具有计数和百分比的列

  • 0

我在下面有一个数据表,我想使用 MS Access Query 创建一个查询以生成如下所示的结果表,其中包含计数和百分比。我无法创建这个。

Name
Alex
Alex
Bob
Bob
Roger
Tim

结果表下方

 Name    Count Percentage
 Alex    2     33%
 Bob     2     33%
 Roger   1     16.6%
 Tim     1     16.6%
ms-access ms-access-2016
  • 1 个回答
  • 38 Views
Martin Hope
whatin1992
Asked: 2018-01-06 07:09:47 +0800 CST

如果我从用户的前端删除对后端表的查询,数据库损坏是否会进一步最小化?

  • 1

我有一个被 30 人使用的 MS Access 数据库。他们都在一天中的不同时间使用它,但在任何 8 小时的时间块内,可能有 10 个人在使用它。该数据库未在前端和后端之间拆分。主要过程是用户填写表格,然后 VBA 代码将此信息写入表格。

我现在想制作这个数据库的新版本,其中前端与后端分开。这是因为整个数据库多次损坏,我们所有的数据、查询和表单都丢失了。

我注意到在其中一种形式上我有一个控件正在查询正在移动到后端的表。我不确定让每个用户的前端本地副本仅针对这个控件查询后端表是否值得。我想最大限度地减少数据库损坏,那么我是否应该只删除对后端表的任何查询,只允许用户对后端表进行一次主要写入?或者这无关紧要?

ms-access-2016 string-splitting
  • 1 个回答
  • 35 Views
Martin Hope
Zsmaster
Asked: 2017-12-02 04:43:29 +0800 CST

在 MS access 中存储长数字

  • 2

如果字段不能为空,如何在 MS Access 2016 中存储 12 个字符长的数字?

ms-access ms-access-2016
  • 1 个回答
  • 35 Views
Martin Hope
MightyRavendark
Asked: 2017-11-06 06:21:19 +0800 CST

比较 M:N 关系中的所有属性

  • 1

我是数据库开发的新手,我确信我当前的问题很普遍。不幸的是我还找不到解决方案——主要是因为我不确定如何正确命名它;)所以如果已经有可用的解决方案或者有更好的描述方式,请告诉我,我会重命名这个帖子。

我的问题是我有一个具有 M:N 关系的数据库,我正在寻找一种方法来检查记录是否已经存在。

例子:

最小示例 ER 模型

书籍可以有多个出版地点和作者。为避免重复,应在添加新书之前检查数据库。如果只有一位作者和出版地,查询将只返回一条记录:

在此处输入图像描述

但是,如果有两个作者,则将返回同一本书的 2 行。更复杂的是,假设有两本书的书名、出版年份和页数相同,但作者不同,这将被返回:

在此处输入图像描述

这就是我的问题开始的地方:我想检查 book_id 为“2”的记录是否已经存在(显然不知道 book_id),如果它存在,它的 book_id 是什么。在这个例子中,实现这一点的唯一方法是检查两个作者的名字(或 ID 以使其更短一些)是否与其中一本在标题、年份和页数中具有 destinct 值的书相关联——我没有知道如何做到这一点(最好是在 SQL 中)。

所以提前感谢您的帮助:)

subquery ms-access-2016
  • 1 个回答
  • 202 Views
Martin Hope
MGaddict
Asked: 2017-04-22 09:14:00 +0800 CST

运行 VBA 后,我失去了对数据库的独占访问权限

  • 0

我写了一些 VBA 来轻松地将 excel 电子表格导入到我的数据库中的表中。这样,用户只需单击表单上的一个按钮,并回答有关要导入的文件的一些问题。问题是导入完成后,我尝试修改数据库中的任何其他内容,但收到消息“此时您没有对数据库的独占访问权限。如果继续进行更改,您可能以后不能救他们了。” 然后我必须退出数据库并重新打开它以进行任何更改。我以前在其他版本的 Access 上做过这个没有问题。所以我不知道是我在某个地方有错字,还是从 Access 2013 到 2016 发生了某些变化导致了这个问题。目前,数据库位于我的本地机器上。最终,这将被移动到 SharePoint 站点并拆分为 2 个访问文件。在它主要工作之前我不想这样做,因为我没有任何地方可以上传到 SharePoint 而没有很多人可以访问它。

Private Sub ImportNewTB_Click()
On Error GoTo ImportNewTB_Click_Err 'If an error occurs anywhere along the way, make sure you still clean up the memory before quiting

Dim OwssvrFile As DAO.Database 'This is the open connection to the file
Dim OwssvrInfo As DAO.Recordset 'This is the recordset for the teachers information
Dim fileName As String 'This is the name of the file being opened
Dim dbs As DAO.Database
Dim CurrentTBDB As DAO.Recordset 'This is to make a connection to our current table
'Dim ExcelHdrs(0 To 20) As Variant 'This is an Array with the headers from the Excel file.
Dim numRecords As Integer
Dim WksName As String
Dim TimeStamp As Date

fileName = getOpenFile() 'Use the function I built in the Module
If fileName = "" Then GoTo ImportNewTB_Click_Exit 'If they didn't select anything, then just give up on life and exit

WksName = InputBox("Enter the name of the worksheet: ", "Worksheet Name", "owssvr")
numRecords = InputBox("Enter the number of records in the Worksheet: ", "Num Records", 2412)
WksName = WksName & "$A1:BE" & numRecords + 1

'Once we have a real file, open it already
Set OwssvrFile = OpenDatabase(fileName, False, True, "Excel 12.0; HDR=YES;")
'Create Recordset from the excel file.
Set OwssvrInfo = OwssvrFile.OpenRecordset(WksName)
OwssvrInfo.MoveFirst 'Goto the first line of the recordset

Set dbs = CurrentDb
Set CurrentTBDB = dbs.OpenRecordset("SELECT * FROM CurrentTB")

TimeStamp = Now()

Do
    With CurrentTBDB
        .AddNew
        .Fields!EntryDate = TimeStamp
        .Fields!ProjectName = OwssvrInfo.Fields(0)

        .Update
    End With

    OwssvrInfo.MoveNext 'All of that for entry 1, only 2000 more lines to go
Loop Until OwssvrInfo.EOF

' Tidy up, This closes everything out and releases the memory
ImportNewTB_Click_Exit:
On Error Resume Next 'Basically this says, if there's an error, I don't care, do this anyway
MsgBox "Input Complete!"
OwssvrInfo.Close
OwssvrFile.Close
CurrentTBDB.Close
Set CurrentTBDB = Nothing
Set dbs = Nothing
Set OwssvrInfo = Nothing
Set OwssvrFile = Nothing
Exit Sub

ImportNewTB_Click_Err: 'This produces an error message if one exists
MsgBox Err.Number & " " & Err.Description, vbCritical, "Error!"
Resume ImportNewTB_Click_Exit 'Make sure we still clean up before leaving
End Sub
vba ms-access-2016
  • 1 个回答
  • 338 Views
Martin Hope
Tim S.
Asked: 2017-02-23 14:13:48 +0800 CST

将一个表的两个字段关联到另一个表的一个字段

  • 1

我有两个看起来像这样的表:

Table1               Table2
ID | Appname         ID  | App  | Dependency
------------         -----------------------
1  | App1            1   | 2    |  3
2  | App2            2   | 3    |  1
3  | App3            3   | 2    |  1
etc....               etc...

基本上,一个应用程序可以具有一个或多个依赖项,这些依赖项必须在执行之前完成。在 Table2 中, 和 都App与DependencyTable1 的 ID 字段相关,但我很难将它们与 SQL 链接在一起而不会出错。

连接表的正确方法是什么,以便我得到如下所示的结果:

Dependencies:
App2: App3, App1
App3: App1

(不一定非要这样布置,但如果可以的话,那就太好了)

ms-access ms-access-2016
  • 1 个回答
  • 253 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve