通过列表框控件来更新数据库字段 [英] Update database field by tabbing through listbox control

查看:123
本文介绍了通过列表框控件来更新数据库字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表框控件(MSAOwnerNo),我根据在表单上的其他2个组合框中输入的值使用查询进行更新。 它绑定到一个字段MSAOwnerNo,它位于一个名为tblRFCs的表中。

I have a listbox control (MSAOwnerNo) that I update using a query based on values entered in 2 other combo boxes on a form.  It is bound to a field, MSAOwnerNo, that is in a table called tblRFCs.

SELECT tblProjects.ProjectID,briProgramsVendors.FKVendorID,briProgramsVendors.MSAOwnerNo

FROM FROM tblProjects INNER JOIN briProgramsVendors ON tblProjects.FKProgramID = briProgramsVendors.FKProgramID

WHERE(((tblProjects.ProjectID)= [forms]![frmCreateRFC]![FKProjectID])AND((briProgramsVendors.FKVendorID)= [forms ]![frmCreateRFC]![FKContractorVendorID]));

SELECT tblProjects.ProjectID, briProgramsVendors.FKVendorID, briProgramsVendors.MSAOwnerNo
FROM tblProjects INNER JOIN briProgramsVendors ON tblProjects.FKProgramID = briProgramsVendors.FKProgramID
WHERE (((tblProjects.ProjectID)=[forms]![frmCreateRFC]![FKProjectID]) AND ((briProgramsVendors.FKVendorID)=[forms]![frmCreateRFC]![FKContractorVendorID]));

当用户选择VendorID和ProjectID时,查询会将MSAOwnerNo返回到列表框。 而不是必须单击列表框以选择MSA编号从而更新表中的字段,我只想通过控件
进行选项卡,这样用户就不必将他的手从键盘上移开并抓住鼠标,选择列表框,然后将手放回键盘。 如何使用控件事件(如LOSTFOCUS)和  VBA?

When the user selects the VendorID and ProjectID, the query returns the MSAOwnerNo to the listbox.  Rather than having to click on the listbox to select the MSA number thereby updating the field in the table, I would simply like to tab through the control so the user does not have to take his hands off the keyboard and grab the mouse, select the listbox, and then return his hands to the keyboard.  How can I do this using a control event, like LOSTFOCUS, and VBA?

推荐答案

Hello Gordon:

Hello Gordon:

根据你的问题,"如何使用控件事件(如LOSTFOCUS和VBA?)来执行此操作?...您是否在此表单上使用VBA当前
包含任何事件?

问候,


这篇关于通过列表框控件来更新数据库字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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