简体   繁体   English

Access 2013-DlookUp

[英]Access 2013 - DlookUp

I now have tried DLookUp , but I do not get the result I want. 我现在尝试了DLookUp ,但是没有得到想要的结果。

My Situation: I am creating a database for a cinema. 我的情况:我正在为电影院创建数据库。 It includes tables named cinemas, movies, sold seats, price. 它包括名为电影院,电影,售票,价格的表。

I have made a form where I can record a new "guest". 我制作了一个表格,可以在其中记录新的“客人”。 I can select the ID of the Show and then I see the date and the time. 我可以选择表演的ID,然后看到日期和时间。 I now have recorded some guests and now there should be less seats free. 我现在记录了一些客人,现在应该有更少的空位了。 I want to show that on the same form as the one where I record new guests. 我想以与记录新客人相同的形式来证明这一点。 I don't get up with the Dlookup . 我不喜欢Dlookup

I have made this query which calculates how many seats are left but I cannot put that into the form. 我进行了此查询,该查询计算了剩余的座位数,但我无法将其放入表格中。

SELECT
    tbl_Vorstellung.ID_Vorstellung,
    tbl_Kino.Kino,
    Sum([tbl_Kino]![Sitzplätze]-[qry(02)PlätzeVerkauft]![AnzahlvonTicketNummer]) AS Ausdr1
FROM
    tbl_Kino
    INNER JOIN ([qry(02)PlätzeVerkauft]
    INNER JOIN tbl_Vorstellung
    ON [qry(02)PlätzeVerkauft].ID_Vorstellung = tbl_Vorstellung.ID_Vorstellung)
    ON tbl_Kino.ID_KINO = tbl_Vorstellung.FS_KINO
GROUP BY
    tbl_Vorstellung.ID_Vorstellung,
    tbl_Kino.Kino;

Save your working query as a new name, for this example MyQuery 将工作查询另存为新名称,例如MyQuery

Then use 然后使用

DLOOKUP("Ausdr1", "MyQuery", "ID_Vorstellung=SomeValue AND Kino=SomeValue")

On your form. 在您的表格上。 You'll have to put in the SomeValue values based on fields on your form, etc. 您必须根据表单上的字段等输入SomeValue值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM