在连续表格上将记录设为主要 [英] Set Record as Primary on Continuous Form

查看:47
本文介绍了在连续表格上将记录设为主要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一张名为
的桌子
Adress_tbl


然后我有一个名为<的连续表格br />
Adress_frm


在这种形式中,我有一些文本框,然后是是/否复选框。

表中的复选框列称为primary表格中的复选框称为txtPrimary


此复选框应允许用户标记主要地址。地址是第一个在报告等其他功能中使用的地址。


但由于它是一个连续的用户形式,可以选择每一行的是/否复选框...我只想允许1个复选框。


有没有办法让VBA检查是否有任何复选框已经设置为yes,如果是,则显示一个msgbox如果不允许用户将复选框设置为是。

或者取消msgbox取消选中当前标记的复选框并设置用户想要的复选框。

Hey

I have a table called
Adress_tbl

Then i have a Continuous form called
Adress_frm

In this form i have some textboxes and then a YES/NO check box.
Checkbox column in table is called "primary" and checkbox in form is called "txtPrimary"

This checkbox is supposed to allow the user to mark the adress that is "primary". The address that is the first one to use in other functions like reports etc.

But since it is a continuous form the user as it is, can select every row′s YES/NO checkbox... i just want to allow 1 checked checkbox.

Is there a way with VBA to check if there is any checkbox already set to yes, if so is, display a msgbox if not allow the user to set the checkbox to yes.
Or instead of msgbox uncheck the currently marked checkbox and set the one that the user wants.

推荐答案

behedwin,


我确信你的连续表格/是/否复选框中有不正确的设置。连续形式的是/否字段应允许为每条记录检查是或否。显然情况并非如此,所以在我们变得太复杂之前,我们需要更多地了解您的表格。


您的表格是连续表格还是数据表(有些人会混淆两者) )?


表格的部分详细信息中是否有复选框控件?顺便说一句,您还应该将其命名为 chkPrimary 以指示它的控制类型。


在这种情况下,屏幕截图在设计视图中您的表单可能会有所帮助(请修剪原始图像以显示表单,因为我们的图像限制为500像素宽)。


我希望这可见!支持更多!
behedwin,

I am convinced that there is something set improperly with your continuous form/YES/NO Check box. A Yes/No Field in a continuous form should allow for checking Yes or No for each record. This is obviously not the case, so before we get too complicated, we need to know more about your form.

Is your form a continuous form or a datasheet (some people confuse the two)?

Is the Check Box control within the Section Detail of the Form? BTW,you should also name it chkPrimary to indicate the type of control it is.

In this case, a screen shot of your form in design view might help (please trim the original image to showjust the form, as our images are limited to 500 pixels wide).

I hope this hepps! Standing by for more!


这里有一些截图。


表格(adress_frm)是一个连续的表格,而不是数据表(它应该是屏幕截图中显示)


i知道我可以为连续表格中的每条记录检查是和否。但是我只想对整个表格允许一个是,无论是有100个记录还是只有两个。

如果用户进入表格,看到20条记录(行),那么我想控制用户,这样只有一个复选框可以设置为是,其他复选框保持不...


只有一个地址应该能够被标记为是,因此主要地址将用于显示在未来的报告中。


fyi:隐藏了名为adress_id的文本框。

okey here are some screenshots.

the form (adress_frm) is a continuous form, not datasheet (it should be shown in screenshots)

i know i can check yes and no for each record in a continuous form. But i only want to allow one yes for the whole form no matter if there is 100 records or just two.
if user go in to form, see 20 records (rows), then i want to control the user so that only one checkbox can be set to yes and the others stay on no...

only one adress should be able to be marked as YES and therefor be the primary adress to be used to display for example in a future report.

fyi: the textbox called adress_id is hidden.

附加图像
(42.8 KB,270 views)
(62.1 KB,266 views)
Screenshot_5.jpg (31.1 KB,263 views)
Attached Images
(42.8 KB, 270 views)
(62.1 KB, 266 views)
Screenshot_5.jpg (31.1 KB, 263 views)



i知道我可以为连续表格中的每条记录检查是和否。但是我只想对整个表格允许一个是,无论是有100个记录还是只有两个。

如果用户进入表格,看到20条记录(行),那么我想控制用户,这样只有一个复选框可以设置为是,其他复选框保持不... ... b $ b
i know i can check yes and no for each record in a continuous form. But i only want to allow one yes for the whole form no matter if there is 100 records or just two.
if user go in to form, see 20 records (rows), then i want to control the user so that only one checkbox can be set to yes and the others stay on no...



好​​的 - 现在你的问题对我来说更有意义了!


在我们变得太深之前,我必须问问哪一个您要应用以下条件:

OK - now your question makes much more sense to me!

Before we get too deep, I must ask which of the following conditions you want to apply:

  1. 用户可以选择一个地址或另一个地址,但不能选择两个地址作为主要地址。也就是说,用户可以自由地从 任何 的地址中进行选择,但 从不 多个
  2. 如果已经选择了主要地址,则用户 禁止 选择另一个。
  1. The user can select one address, or another address, but never two addresses as the primary. That is, the user can freely pick and choose from any of the addresses, but never more than one
  2. If there is already a primary address selected, the user is prohibited from choosing another.



我认为你想要完成#1?


无论哪种方式,你将要从复选框的BeforeUpdate事件中完成此操作。你如何处理这些可能需要你提供一些额外的信息。


这不是一个非常困难的解决方案,但这将取决于你目前的VBA专业水平。我只是要求你仔细跟踪事情,一切都会好的。


等待更多的hepp!


I think you are trying to accomplish #1?

Either way, you will want to accomplish this from the BeforeUpdate event of the Check box. How you go about that could take some additional information from you.

This is not a terribly difficult solution, but this will depend on your current level of expertise in VBA. I just ask you to follow things carefully and all will be well.

Standing by for more hepp!


这篇关于在连续表格上将记录设为主要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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