需要帮助在列表框中获取要更改的值。 [英] Need help getting values to change in a list box.

查看:44
本文介绍了需要帮助在列表框中获取要更改的值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个订单跟踪数据库,为了使这个解释简单,包括''订单''表,''订单明细''表,''交货''表和& ''库存''表。

从订单到''订单详情,订单到交货和订单到库存都有一对多的关系。

我有表格输入和跟踪客户订单和库存交易;这些工作正常,但我很难让列表框控件按照我想要的方式在交付表单上工作。

我使用表单向导创建了一个绑定拆分表单。主窗体绑定到Orders,子窗体绑定到Inventory。目的是从库存中选择要交货的物品。

我在主表单中添加了一个列表框,以显示订单详细信息表中的订单代码和数量。列表框后面的查询具有从订单明细表中进行选择的标准,其中订单表中的订单号等于表单上文本框中显示的订单号。我遇到的困难是当我在订单之间移动时,这个列表框不会更新 - 它只显示第一个订单明细数据。然而,主窗体上的其他文本框绑定到同一个Order Details表,它按预期工作。有人可以帮我把表格的这一部分搞定吗。

解决方案

你没有提供任何代码,所以我猜这个并使用说明性的对象名称。我告诉你要做的是在订单之间移动时重新查询列表框(位于主(父)表单上)。

展开 | 选择 | Wrap | 行号

我没有发布我的代码,以防它引起人们误入歧途 - 我希望找到问题的答案,而不是修复我笨拙的代码。我尝试了你提供的代码 - 它看起来像这样:

展开 | 选择 | Wrap | 行号


此时,我认为最可能的原因是requery不起作用的是语法不正确。您声明列表框位于主窗体上,我假设它名为deliveryies。如果订单表单是主表单的子表单,并且代码放在Ordersubform后面,则语法如下:

Private Sub OrderNumber_Change()''将代码放在OrdersSubform后面
Me.Parent.List27.Requery

End Sub


如果这不起作用,请按名称列出您的表格和子表格,以及说明哪一个有列表框,哪一个有重新查询代码。

示例

MainForm交付(有列表框)

Subform1订单(有重新查询)代码)

子表格2

其他......你需要在yourOrderNumber_Change proc中设置一个控制中断来确定它是否正在触发。


I am developing an order tracking database, which to keep this explanation simple, consists of ''Orders'' table, ''Order Details'' table, ''Deliveries'' table & ''Inventory'' table.
There are one-to-many relationships from Orders to ''Order Details, Orders to Deliveries and Orders to Inventory.
I have forms to enter and track customer orders and inventory transactions; these work fine but I am having difficulty getting a list-box control to work the way I want on the deliveries form.
I have created a bound split form using the forms wizard. The main form is bound to Orders and the subform bound to Inventory. The intention is to pick from Inventory, items for delivery.
I have added a list-box to the main form to display item order code and quantity from the Order details table. The query behind the list-box has a criterion to select from Order Details table where order number from Orders table equals the order number displayed in a text-box on the form. The difficulty I have is that this list-box does not update when I move between orders - It shows only the first Order Details data. Yet I have other text-boxes on the main form bound to the same Order Details table that do work as expected. Can someone help me get this part of the form working please.

解决方案

You did not provide any of your code, so I am guessing on this and using illustrative object names. What I am telling you to do is requery the listbox (located on the main (parent) form) when you move between orders.

Expand|Select|Wrap|Line Numbers


I did not post my code in case it lead people astray - I was hoping for an answer to the problem, not a fix for my clumsy code. I tried the code you provided - It looks like this:

Expand|Select|Wrap|Line Numbers


At this point, I think the most likely reason the requery did not work is that the syntax is incorrect. You stated that the listbox is on the main form, which I assume is named deliveries. If the order form is a subform of the main form and the code is placed behind the Ordersubform, the syntax would be as follows:
Private Sub OrderNumber_Change() ''place code behind the OrdersSubform
Me.Parent.List27.Requery
End Sub

If this does not work, please list your forms and subforms by name, and state which one has the listbox and which one has the requery code.
example
MainForm Deliveries (has listbox)
Subform1 Orders (has requery code)
Subform2
Something else ....you need to place a control break in yourOrderNumber_Change proc to determine if it is firing.


这篇关于需要帮助在列表框中获取要更改的值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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