简体   繁体   中英

MS Access: Use query as control source for textbox

I have this query which returns a single value:

SELECT Sum(Track.duration) AS [Run time]
FROM Track INNER JOIN ContainsTracks ON Track.trackName = ContainsTracks.tracks
WHERE (((ContainsTracks.albums) Like [Forms]![AlbumDuration Param Query]![Combo1]));

I would like this value to appear in a textbox on the same form from which I get the albums value (AlbumDuration Param Query is the name of the form, the query is called AlbumDuration).

I searched this up and found that putting this in the control source of the textbox should work:

=DLookUp("Run time","AlbumDuration")

But that just displays an error.

How can I display the contents of my query in a textbox?

您需要使用方括号将“运行时”包围起来,因为它包含空格:

[Run time]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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