如何搜索字段,并通过SQL更新相应的字段 [英] How to search for field, and update corresponding field via SQL

查看:77
本文介绍了如何搜索字段,并通过SQL更新相应的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

frmBOX_SHIPPING上的字段收到一个5位数的CUST_NUM(文本字段),提取该客户的最新订单(ORDER_NUM(文本字段),然后接受分配给此订单的方框号码(BOX_NUM,文本字段)。在此过程中,将DATE_BOX_SHIP = date()分配给方框号。


tblORDERS包含ORDER_NUM并且有自己的日期位置:DATE_SHIP。这不是多余的信息,因为它可能会被分开并在不同的日期发货。所以这就是我想做的事情:


当frmBOX_SHIPPING收到5位CUST_NUM并拉出ORDER_NUM时,将输入一个方框号并分配一个日期。我想要一个post_update事件,附加到tblBOX。 BOX_NUM在tblORDERS中查找匹配的ORDER_NUM,如果对应的tlbORDERS.DATE_SHIP为null,则将其设置为Date()。如果它不为null,则不执行任何操作(这意味着先前运行的代码集日期)。


如果我没有提供足够的信息,请告诉我。


提前致谢!
Danica

A field on frmBOX_SHIPPING receives a 5 digit CUST_NUM (text field), pulls up that customer''s most recent order (ORDER_NUM (text field), and then accepts box numbers (BOX_NUM, text field)assigned to this order. During this process a DATE_BOX_SHIP = date() is assigned to the box number.

tblORDERS contains the ORDER_NUM and has its own place for a date: DATE_SHIP. This is not redundant information because it''s possible the boxes could get seperated and ship out on different dates. So here''s what I want to do:

When frmBOX_SHIPPING receives the 5 digit CUST_NUM and pulls up the ORDER_NUM, a box number will be entered and a date will be assigned. I''d like an after_update event, attached to the tblBOX.BOX_NUM to look in tblORDERS for the matching ORDER_NUM, and if the corresponding tlbORDERS.DATE_SHIP is null, set it to Date(). If it is not null, do nothing (that would imply a previous run of the code set the date).

If I''m not providing enough information, please let me know.

Thanks in advance!
Danica

推荐答案

这样的事情可以解决问题,可能要检查字段/表名称以确保它们是正确的。

Something like this should do the trick, may want to check the field/table names to be sure they are correct.

展开 | 选择 | Wrap | 行号


哇Megalog,这很快。我所做的就是去吃午饭并吃三明治。而且,繁荣,SQL。 ;-)

我会尝试这个,让你知道它是否有效。

谢谢,

Danica
Wow Megalog, that was fast. All I did was go to lunch and get a sandwich. And, boom, SQL. ;-)
I''ll try this and let you know if it works.
Thanks,
Danica


Megalog,


行有问题2.我试过
Megalog,

There is a problem with line 2. I have tried
展开 | 选择 | Wrap | 行号


这篇关于如何搜索字段,并通过SQL更新相应的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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