简体   繁体   English

我们如何通过仅使用代码生成器从 ms-access 中的表源更新特定字段来填充其他表单字段

[英]How can we populate other form fields by updating a specific field from table sources in ms-access using code builder only

I have the below problem:我有以下问题:

  • I have a student table in access with field class, classfee and leaves我有一个学生表可以访问,其中包含字段 class、classfee 和 leave
  • and another table namely classes with fields class, monthlyfee and leaves和另一个表,即具有字段 class、月费和叶的类
  • I have related both tables with a one to many relationship我已将两个表与一对多关系相关联
  • now i have created a form as shown in images and i want when i choose class from the drop down box the leave and fee field should come up automatically from the classes table fields (monthlyfee and leaves)现在我已经创建了一个如图所示的表格,当我从下拉框中选择 class 时,请假和费用字段应该从类表字段(月费和请假)中自动出现

Problem explained in this image这张图片中解释的问题

Code explained here代码解释here

tables relationship here表关系在这里

Private Sub Class_AfterUpdate()

Me.Fee.RowSource = "SELECT ClassFee FROM" & _
                   "Classes Where Class_ID = " & Me.Class

Me.Fee = Me.Fee.ItemData(0)

End Sub

You forgot the error message that probably tells about a syntax error, as you missed the space here:您忘记了可能说明语法错误的错误消息,因为您错过了此处的空格:

Me.Fee.RowSource = "SELECT ClassFee FROM " & _
               "Classes Where Class_ID = " & Me.Class

暂无
暂无

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

相关问题 如何将没有表单字段的值以及其余表单字段作为新记录ms-access 2013发送到表? - How to send a value which does not have a form field, along with the rest of the form fields to a table as a new record ms-access 2013? MS-Access - 来自表单的 MailMerge 特定记录 - MS-Access - MailMerge specific record from a form MS 访问一个表格到 select 表值并用于填充其他表格上的多个字段? - MS Access one form to select table values and use to populate multiple fields on other form? 有没有办法在不使用表格的情况下在 MS-Access 中创建表单? - Is there a way to create a Form in MS-Access without using a table? 如何使用 VBA 从 MS-Excel (2010) 查询 MS-Access 表 - How to query a MS-Access Table from MS-Excel (2010) using VBA 我如何将表单中的列中的所有文本集成到textBox中,Microsoft Access VBA ms-access - how can i Integration all texts from a column in a form to a textBox Microsoft Access VBA ms-access 跳转到父表单(MS-Access表单/ VBA)中的特定记录 - Jumping to a specific record in a parent form (MS-Access form / VBA) 如何使用不同表中数字字段的 SUM 更新数字字段 MS-ACCESS 13 - How to Update a numeric field with the SUM of the numeric field in a different table MS-ACCESS 13 MS Access 2019:无法使用 VBA 中的 SQL 查询填充表单字段 - MS Access 2019: Can't populate a form field using SQL query in VBA MS-Access VBA:如果触发了Form_Error事件,如何将字段值设置回旧值 - MS-Access VBA: How to set field value back to old value if Form_Error event is triggered
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM