使用表单中的数据更新Access表的字段 [英] Updating a field of an Access table with data from form

查看:162
本文介绍了使用表单中的数据更新Access表的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Access 2007.我有一张包含一些字段的表格。我从表中创建了一个表单,其中一个字段的一个字段是来自同一个表的两个字段的串联。



有两个字段,OppNo和Material in桌子。我用这些(和表中的其他人)字段创建了一个表单。还有另一个字段OppMat在表中是空白的。但是,我已将数据转换为OppMat字段,并将其填充为表单中的OppNo和Material字段的串联。我现在正在考虑让表中的OppMat数据更新到表中相同的对应字段中。



请告诉我如何实现这一目标。



感谢和问候,

解决方案

这可能是如果符合以下情况,可能是




  • 字段OppMat ALWAYS具有相同的结构,您可以确保它符合要求。 / li>
  • 用户无法或不太可能偏离此结构。



值得注意的是,您应该使用像Left(),Right(),Mid()等等。无论什么最适合你的结构。您可以使用字符串修饰符: https://msdn.microsoft.com/en-另一方面,如果您的解决方案是最好的,我必须承认我很抱歉。 。以下是我的理由



我对替代品的建议:




  • 为每个字段使用一个文本框,以便您有两个文本框。你甚至可以这样定位它,它几乎看起来像是连续的文本。但不会太多,否则用户会被灌输。

  • 您可以添加显示连接字段的标签。但是对于输入您使用两个不同的文本框。



干杯!


I am working on Access 2007. I have a table with some fields in it. I had created a form from the table and one of the fields of the table is a concatenation of 2 fields from the same table.

There are 2 fields OppNo and Material in the table. I had created a form with these (and others in the table) fields. There is another field OppMat which is blank in the table. However, I had got the data into OppMat field populated as a concatenation of OppNo and Material fields in the form. I am now looking at having the table updated with the data of OppMat from the form to the same corresponding field in the table.

Kindly advise as how I could achieve this.

Thanks and regards,

解决方案

This might be possible if these cases are met:

  • The field OppMat ALWAYS has the same structure and you can assure that it does.
  • Users will not be able or very unlikely to deviate from this structure.

Notably you should use something like Left(), Right(), Mid() and so on. Whatever works best for your structure. You can use the string modifiers: https://msdn.microsoft.com/en-us/library/dd789093.aspx

On the other hand I must admit that I am sceptical if your solutions is the best. Here are my reasons:

  • Users are unpredictable and will continously deviate from your intended way to use the application.
  • Using the string functions and fixating on one structure makes your code construction inflexible, hard to maintain if changes occur and prone to errors.
  • The alternatives seem to be better with little drawback.

My suggestions for alternatives:

  • Use one textbox for each field so that you have two textboxes. You can even position them that way that it almost looks like it is continous text. But not too much otherwise the user will beconfused.
  • You can add a label that shows your concatenated fields. But for input you use two different textboxes.

Cheers!

这篇关于使用表单中的数据更新Access表的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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