如何从列表框中删除记录? [英] How to delete a record from a list box?

查看:66
本文介绍了如何从列表框中删除记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是这里的新手,所以请耐心等待......


背景:

我有一张病人表( TblPtDemographics)与相关的形式(FrmPtDemographics)。主键是PtID。

每个PtID都有一个TblKneeSxInfo的手术列表,主键是SxKneeID。


现在,我有一个列表框(LbxKneeSx)在FrmPtDemographics中设置,显示特定患者的手术;我的绑定列是2(SxKneeID)。

我已经想出了如何编辑按钮来编辑所选内容并将记录添加到TblKneeSxInfo。我正在尝试删除所选记录的删除按钮,但遇到了一些问题。

我有一个删除查询(qryDeleteKneeSxInfo),但当我设置查询运行时按钮单击,我被要求输入参数值。我不知道如何让它识别这里的具体列表框选择....请帮忙!谢谢!

解决方案

通过表单删除记录涉及命令:

展开 | 选择 | 换行 | 行号


我遇到的问题是当我把它放在我的按钮上的click事件上时,它会删除TblPtDemographics中的当前记录。

我想要的记录删除位于TblKneeSxInfo中,它显示在列表框中(它显示在FrmPtDemographics中,但通过列表框查询拉出)。


我可以设法删除一个记录d使用我的删除查询,但是当我从列表框中选择它时,必须输入参数值只是一件痛苦的事。





Naked只是裸体,nekkid意味着你没有好处!


有趣。您可能最好在表单代码中重新创建删除查询的SQL,并将ListBox控件中的选定值作为该SQL的一部分包含在内。

JenniferM:

Naked只是裸体,nekkid意味着你没有好处!



好​​吧,也许我不太理解术语,但我永远不会发现它不好!


I''m a newbie at this, so bear with me...

Background:
I''ve got a table of patients (TblPtDemographics) with an associated form (FrmPtDemographics). The primary key is PtID.
Each PtID has a list of surgeries in TblKneeSxInfo, with a primary key of SxKneeID.

Right now, I have a list box (LbxKneeSx) set up in FrmPtDemographics that shows the surgeries for the particular patient; my bound column is 2 (SxKneeID).
I''ve figured out how to make buttons to edit selected and add records to TblKneeSxInfo. I''m trying to have a delete button to remove the selected record, but have run into some problems.
I have a delete query (qryDeleteKneeSxInfo), but when I set the query to run upon a button click, I''m asked to enter a parameter value. I don''t know how to make it recognize the specific list box selection here.... Please help! Thanks!

解决方案

Deleting a record via a form involves the command :

Expand|Select|Wrap|Line Numbers


The problem I''m running into with this is that when I place this on the click event on my button, it deletes the current record in TblPtDemographics.
The record I want to delete is located in TblKneeSxInfo, which is displayed in a listbox (It''s shown in FrmPtDemographics, but is pulled via the listbox query).

I can manage to delete a record using my delete query, but it''s just a pain to have to type in the parameter value in when I''ve already selected it from the list box.




Naked is just naked, and nekkid means you''re up to no good!


Interesting. You''re probably best off recreating the SQL of the delete query within the code of your form and including the selected value from the ListBox control as part of that SQL.

JenniferM:
Naked is just naked, and nekkid means you''re up to no good!

Well, maybe I don''t understand the terminology quite properly, but I''ve never found it to be no good!


这篇关于如何从列表框中删除记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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