需要帮助在VBA中创建Access Report [英] Need help creating Access Report in VBA

查看:102
本文介绍了需要帮助在VBA中创建Access Report的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在生成从VBA菜单屏幕发起的学生转录报告。用户单击menue选项以生成学生成绩单。 vba代码要求用户输入学生ID。 vba获取用户ID,验证学生是否在数据库中。我已经预设了报告(表格)已经创建了报告标题信息,标签和文本框,包括学生证,姓名,课程等。这部分我已经完成了。


这里是我正在努力:我希望vba代码将学生ID传递给Access Report表单或者它的查询,并且它将使用该ID来搜索Courses-Taken。如果学生已完成至少一门课程,则会生成学生的成绩单报告。如何将学生ID传递给报告表格或其基本查询是我的问题所在。


任何帮助将不胜感激。


谢谢,

Nzaae

I am generating a student transcipt report initiated from a VBA Menu screen. The user clicks a menue option to generate a student transcript. The vba code asks the user to enter the student ID. The vba gets the user ID, verifies the student is in the database. I have preset Report (form) already created with Report header information, labels and textbox for student ID, Name, Courses taken, etc. This portion I have already done.

Here is where I am struggling: I want the vba code to pass the student ID to the Access Report form or it''s query and it would use the ID to search a "Courses-Taken" table and if the student has completed at least one course, it would generate the student''s transcript report. How to pass the student ID to the Report form or its underlying query is where my problem is.

Any help would be appreciated.

Thanks,
Nzaae

推荐答案

Nzaaev,


创建一个使用Query的SQL字符串对于报告的记录源,并使用学生ID作为查询的条件。然后将报告的记录源设置为该查询。这应该可以解决问题。
Nzaaev,

Create a SQL string that uses the Query for the Report''s record source and use the Student ID as the criteria for the query. Then set the report''s record Source to that Query. That should do the trick.


它比这更容易。
It''s even easier than that.
  1. 设计报告(或者更准确地说是基础查询)从所有学生的任何相关表中获取所需的所有信息。
  2. 打开报告时,为所选学生指定一个过滤字符串。


感谢您的回复。但是,这里是我的挂断点:

SELECT StudID

来自StudTable

在哪里StudID = SID;


(1)如何从我的VBA代码将变量SID传递给此查询?

(2)StudTable有多个列。我得到一个提示输入我不需要的其他列的值,并且没有在我的Select语句中指定。如何指定只选择一列,以便我得不到提示?


再次谢谢。我是VBA的新手
Thanks for the response. However, here is where my hangup is:
SELECT StudID
FROM StudTable
WHERE StudID = SID;

(1) How do I pass the variable SID to this query from my VBA code?
(2) StudTable has more than one column. Iam getting a prompt to enter values for the other columns which I do not need and did not specify in my Select statement. How do I specify to select only one column so I do not get the prompt?

Thanks, again. I am new to VBA


这篇关于需要帮助在VBA中创建Access Report的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆